Hello,
I have an exception during session configuration.
I want to use 2 tables for thoses classes :
The first class must use the table 'Entities' :
Code:
class AbstractEntity {
//with some persistent data
}
This class contained data but JBoss use and other sub-class
Code:
class PersonBean extends AbstractEntity {
//with some persistent data
}
The last class is a sub-class of the previous and must store all the data of
'PersonBean' in 'PERSONS' :
Code:
class PersonBMP extends PersonBean {
//with no data but generated by xdoclet and used by JBoss
}
The problems are :
- it seems that I can't use 'PersonBean' in mappings because the class used to instanciate objects is 'PersonBMP'
- when I use 'PersonBMP' to define mappings, it first super-class is not 'AbstractEntity' and the mappings don't work.
Hibernate version: 3
Mapping documents:
<hibernate-mapping auto-import="true" default-access="property">
<!-- PersonBMP -->
<class name="org.infodavid.data.entities.AbstractEntity" table="ENTITIES" abstract="true">
<id name="primaryKey" column="entity_id" type="java.lang.Long">
<generator class="identity"/>
</id>
<version name="version" column="version" type="java.lang.Integer"/>
<property name="comment" column="comment" type="java.lang.String"/>
<property name="userData1" column="userData1" type="java.lang.String"/>
<property name="userData2" column="userData2" type="java.lang.String"/>
<property name="identity" column="identity" type="java.lang.String"/>
<property name="image" column="image" type="javax.swing.Icon"/>
<union-subclass name="org.infodavid.data.entities.PersonBean" table="ENTITIES">
<union-subclass name="org.infodavid.data.entities.PersonBMP" table="PERSONS">
<property name="firstname" column="firstname" type="java.lang.String"/>
<property name="birthdate" column="birthdate" type="java.sql.Timestamp"/>
<!--
<many-to-one name="title" class="org.infodavid.data.entities.PersonTitleBMP" column="title_id"/>
-->
</union-subclass>
</union-subclass>
</class>
</hibernate-mapping>
Name and version of the database you are using: Hsql in JBoss