Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.20
Mapping documents: using JPA annotation
Hi guys, I hope I'm not doing something wrong here. There are two problems here actually, but I'm primarily concerned about the first one.
First problem:
I have one base class and two subclasses. Base class has the annotation:
Code:
@DiscriminatorColumn(name="DTYPE", discriminatorType=DiscriminatorType.INTEGER)
@DiscriminatorValue(value="0")
subclass has the
Code:
@DiscriminatorValue(value="0")
Hibernate schema export correctly creates DTYPE column with INTEGER type.
Unfortunately, the hbm.xml files are incorrect. The subclasses hbm.xml file has the "discriminator-value" attribute correct, but the base class hbm.xml is missing the "discriminator" element. At startup, I correctly get the discriminator column not specified error. Manually adding the following to the hbm.xml file causes that to go away.
Code:
<discriminator column="DTYPE" type="java.lang.Integer"/>
Second problem:
"Integer" discriminator type doesn't work. Causes NumberFormatException as the underlying code insists on using value of String. Replacing the above Integer with String causes this problem to go away.
Is there something more I need to do in order to use Integer discriminator values?
Thanks