JPA entity with abstract field needs discriminator

Hello,
this is my first message.

Explaining my problem, i have some entities A,B,C,D that extend from an abstract class X, using @DiscriminatorColumn (so these entities use @DiscriminatorValue to define specific types).

I have another entity that has to contain a field of type X. How can i define this column in JPA? For example, the column has to accept only A,B values (types).
Can i use something like @DiscriminatorValue for the field?

Thanks

What inheritance strategy are you using?

I’m using @MappedSuperclass

Discriminator column is not for MappedSuperclass. You should read the Hibernate User Guide for more details about entity inheritance.