-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: polymorphism=implicit geht nicht
PostPosted: Thu Oct 06, 2005 10:45 am 
Beginner
Beginner

Joined: Tue Mar 15, 2005 5:04 am
Posts: 26
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>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.