-->
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: Inheritence mapping -use of subclass in another mapping file
PostPosted: Thu Oct 08, 2009 12:54 am 
Newbie

Joined: Thu Oct 08, 2009 12:31 am
Posts: 1
I have a mapping file for inheritence mapping - Table per class hierarchy as:

<hibernate-mapping>
<class name="A" table="A_table">
<id column="id" type="long">
<generator class="native"/>
</id>
<discriminator column="disc"/>

<subclass name="B" discriminator-value="B_disc">
</subclass>

<subclass name="C" discriminator-value="C_disc">
<bag name="C_list" table="config_mapping" cascade="all">
<key column="config_id"/>
<many-to-many class="B"
column="mapping_config_id"
unique="true"
not-found="ignore"/>
</bag>
</subclass>


</class>
</hibernate-mapping>


Now i have another mapping file which is as follows:
<hibernate-mapping>
<class name="D" table="D_table">
<id column="id" type="long">
<generator class="native"/>
</id>

<bag name="D_list" table="pf_config" cascade="all">
<key column="pf_id" />
<many-to-many class="B"
column="config_id"
unique="true"
not-found="ignore"/>
</bag>

<bag name="E_list" table="pf_config" cascade="all">
<key column="pf_id" />
<many-to-many class="C"
column="config_id"
unique="true"
not-found="ignore"/>
</bag>


</class>
</hibernate-mapping>

Now when i try to retrieve the list of D_list and E_list in D class i do not get the values only referenced by subclass C or of subclass D based on the discriminator value but instead get the whole set of values of its superclass A in both the lists.

Can anyone tell me why is this happening and the correct way to do it?


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.