-->
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: Mapping not selecting subclass
PostPosted: Wed Jun 13, 2007 7:21 am 
Newbie

Joined: Wed Jun 13, 2007 7:11 am
Posts: 1
I have a simple abstract class with two subclasses. Another class has a one-to-many association with one of the subclasses - mapping files below.

When I retrieve instances of SPVShareholderHO from my code hibernate correctly retrieves using type='SHAREHOLD' in the query.

However, when hibernate retrieve the Set of shareholders from the CounterpartyHO, it does not have type='SHAREHOLD' in the query. Am I doing something wrong? Why does it behave this way?


Thanks in advance for any help.




<hibernate-mapping>
<class table="cp_subcounterparties" name="com.foo.dealframework.dao.impl.hibernate.model.EntityOwnerHO">
<id name="id">
<generator class="native"/>
</id>
<discriminator type="string" column="type" length="10"/>
<property name="touched" insert="false" column="touched" update="false"/>
<many-to-one column="cp_id" lazy="false" name="counterparty" class="com.foo.dealframework.dao.impl.hibernate.model.CounterpartyHO"/>
<many-to-one column="sub_cp_id" lazy="false" name="subCounterparty" class="com.foo.dealframework.dao.impl.hibernate.model.CounterpartyHO"/>
<property name="share" column="percentage"/>
<property name="managementCode" column="management_code"/>
<subclass name="com.foo.dealframework.dao.impl.hibernate.model.DealStakeholderHO" discriminator-value="WATERFALL"/>
<subclass name="com.foo.dealframework.dao.impl.hibernate.model.SPVShareholderHO" discriminator-value="SHAREHOLD"/>
</class>
</hibernate-mapping>


<hibernate-mapping>
<class table="counterparty" name="com.foo.dealframework.dao.impl.hibernate.model.CounterpartyHO">
<id name="id">
<generator class="native"/>
</id>
<property name="name" column="name"/>
<set lazy="false" inverse="true" name="shareholders">
<key column="cp_id" not-null="true"/>
<one-to-many class="com.foo.dealframework.dao.impl.hibernate.model.SPVShareholderHO"/>
</set>
</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.