-->
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.  [ 3 posts ] 
Author Message
 Post subject: lazy loading - problem with composite-id & key-many-to-o
PostPosted: Sun Nov 07, 2004 12:33 pm 
Newbie

Joined: Sun Nov 07, 2004 11:31 am
Posts: 3
Location: Rome
Hibernate version: 2.1.6

Mapping documents:
Parent:
<hibernate-mapping package="pkg">
<class name="A" table="A_TAB">

<!-- Identity column (PK) -->
<composite-id>
<key-many-to-one name="B" class="BClass" >
<column name=".." />
<column name=".." />
<column name=".." />
</key-many-to-one>
<key-many-to-one name="C" class="CClass" >
<column name=".." />
<column name=".." />
<column name=".." />
</key-many-to-one>
</composite-id>

<!-- Properties -->
:
:
:
<!-- private Collection E -->
<set name="E" lazy="true">
<key>
<column name=".." />
<column name=".." />
<column name=".." />
<column name=".." />
<column name=".." />
<column name=".. />
</key>
<one-to-many class="EClass"/>
</set>

</class>

</hibernate-mapping>

Child:
<hibernate-mapping package="pkg">

<class name="EClass" table="E_TAB">

<!-- Identity column (PK) -->
<composite-id>
<key-many-to-one name="A" class="AClass">
<column name=".." />
<column name=".." />
<column name=".." />
<column name=".." />
<column name=".." />
<column name=".." />
</key-many-to-one>
<key-property name=".." column=".." />
<key-property name=".." column=".." />
</composite-id>
</class>
</hibernate-mapping>


The situation is as follows:

We unfortunately have a data model that relies exclusively on composite primary keys.
The references between parent and child records are bi-directional


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 07, 2004 4:15 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
In case of a composite id wo PK class BPK for example, the object itself is probably its onw PK, so it has to be loaded. I'm not 100% sure of that, but try to create a Bpk Epk class.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 09, 2004 6:43 am 
Newbie

Joined: Sun Nov 07, 2004 11:31 am
Posts: 3
Location: Rome
Thanks for the response. I'll give it a go.


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

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.