Home > Back-end >  Hibernate Single Table Inheritance with 2 @DiscriminatorColumn (1 is embedded) is not working
Hibernate Single Table Inheritance with 2 @DiscriminatorColumn (1 is embedded) is not working

Time:01-10

Single @DiscriminatorColumn works fine. Column product_type gets filled with correct discriminator value: First @DiscriminatorCOlumn usage

However, when I introduce 2 more classes that inherit Book, hence another @DiscriminatorColumn, none of the contracts are honored. Neither product_type gets populated (remains null) nor do book_type.

enter image description here

CodePudding user response:

Having multiple disciminator columns on a single entity is not possible according to the documentation

The strategy and the discriminator column are only specified in the root of an entity class hierarchy or subhierarchy in which a different inheritance strategy is applied.

  • Related