Hibernate supports multiple types of inheritance mapping, some of them (Table per class, Table per subclass) using a discriminator column to decide the class.
The type of the discriminator can be one of
string, character, integer, byte, short, boolean, yes_no, true_false
In case you need to use any other than string or character, i.e. integer, you have to give the base class a default discriminator-value like 0 or -1 or whatever fits, otherwise you’ll end up with a an exception like:
org.hibernate.MappingException: Could not format discriminator value to SQL string
as Hibernate uses the class name of the base class to derive a default value.
No comments yet
Post a Comment