Hibernate version: 3.1
Hallo,
ich habe wohl Tomaten auf den Augen.
ich habe ne Classe Account und subclassen DAccount und KAccount
Wenn ich ne Creteria(Account.class).list() mache, dann bekomme ich alle Subclasses mit.
Dann habe ich Process mit sublcassen DProcess und KProcess.
Bei denen geht das nicht. :-0
Hat da jemand ne Idee?
Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="de.datentraum.allrounder.BaseClasses.Account" discriminator-value="A" table="accounts" abstract="true">
<id name="id" type="int" column="account_id" unsaved-value="0">
<generator class="sequence">
<param name="sequence">uid_account</param>
</generator>
</id>
<discriminator column="disc"/>
<property name="accountnumber" type="int"/>
<property name="con" column="condition" type="int"/>
<many-to-one name="partner" column="partner_id" class="de.datentraum.allrounder.BaseClasses.Partner" />
<many-to-one name="tax" column="tax" class="de.datentraum.allrounder.BaseClasses.Tax" />
<set name="articleRelations">
<key column="account_id"/>
<one-to-many class="de.datentraum.allrounder.BaseClasses.ArticleRelation"/>
</set>
<set name="processes">
<key column="account_id"/>
<one-to-many class="de.datentraum.allrounder.Processes.Process"/>
</set>
<subclass name="de.datentraum.allrounder.BaseClasses.DAccount" discriminator-value="D" >
</subclass>
<subclass name="de.datentraum.allrounder.BaseClasses.KAccount" discriminator-value="K" >
</subclass>
</class>
</hibernate-mapping>
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="de.datentraum.allrounder.Processes.Process" table="process" abstract="true" discriminator-value="PROC">
<id name="id" type="int" column="process_id" unsaved-value="0">
<generator class="sequence">
<param name="sequence">uid_process</param>
</generator>
</id>
<discriminator column="disc"/>
<many-to-one name="account" class="de.datentraum.allrounder.BaseClasses.Account" column="account_id" lazy="false"/>
<set name="documents">
<key column="process_id"/>
<one-to-many class="de.datentraum.allrounder.Processes.Document"/>
</set>
<subclass name="de.datentraum.allrounder.Processes.DProcess" discriminator-value="DPRO">
</subclass>
<subclass name="de.datentraum.allrounder.Processes.KProcess" discriminator-value="KPRO">
</subclass>
</class>
</hibernate-mapping>