masber
masber

Reputation: 3067

hibernate + single table inheritance + discriminatorColumn --> DiscriminatorType cannot be resolved to a variable

I am learning hibernate inheritance and would like to change the discrimination column from Stringt o INTEGER so I can reduce the size of my database index.

I have something like this:

@Entity(name = "events")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(
        discriminatorType = DiscriminatorType.INTEGER,
        name = "event_type_id",
        columnDefinition = "TINYINT(1)"
    )

However, my IDE complains that:

DiscriminatorType cannot be resolved to a variable

I am just using Hibernate core dependency

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>5.4.10.Final</version>
    </dependency>

QUESTION: Is there any dependency I am missing? something else?

Upvotes: 0

Views: 550

Answers (1)

masber
masber

Reputation: 3067

My bad...

apparently there are multiple options for this...

this fixed my issue:

import javax.persistence.DiscriminatorType;

Upvotes: 2

Related Questions