|
I my application, I use a table per concrete class hierarchy strategy. I didn't introduce a discriminant column into my tables as this information is useless for Hibernate with this mapping.
My mapping file looks like:
<hibernate-mapping> <!-- Mapping for Super class --> <class name="SuperClass" abstract="true"> <id name="objectId" type="string" unsaved-value="null"> <column name="OBJECT_ID" sql-type="char(32)" not-null="true"/> <generator class="uuid.hex"/> </id>
<version name="versionNumber" column="VERSION_NUMBER"/> ......
<union-subclass name="SubClassA" table="SUBCLASS_A"> <property name="businessId" column="BUSINESS_ID" not-null="true"/> ....... </union-subclass>
<union-subclass name="SubClassB" table="SUBCLASS_B"> <property name="businessId" column="BUSINESS_ID" not-null="true"/> ....... </union-subclass> ..... </class> </hibernate-mapping>
Then, I want to build a polymorphic HQL request using the 'class' property, an error is raised. The request is "select obj.class from SuperClass obj"
So, the question is: Must I add a discriminator column if I want to use the class property even is this information is useless for Hibernate ?
Thanks a lot in advance for any help. (Note I use hibernate version 3.1.3)
|