Here are a few things to keep in mind when using @DiscriminatorColumn
- If you have used this annotation then Hibernate will automatically use the
@DiscriminatorValue
value from the child classes to fill the column value. - Do not define the discriminator column as a regular class property. This will cause Hibernate to consider it a new column and you will see errors like
The column index is out of range: n, number of columns: m.
.
Cheers