-->
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.  [ 2 posts ] 
Author Message
 Post subject: Composite-element Mapping Problem
PostPosted: Tue Jun 21, 2005 10:27 am 
Newbie

Joined: Wed Aug 25, 2004 5:41 am
Posts: 9
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 2.1.2

Mapping documents:


<class
name="com.orange.greco.persistance.dao.masque.bean.MasqueTO"
table="MASQUE"
>

...
...
...

<set
name="masquesChamps"
table="MASQUECHAMP"
lazy="true"
cascade="all"
>
<key>
<column name="ID_MASQUE" />
</key>

<composite-element class="com.orange.greco.persistance.dao.masque.bean.MasqueChampsTO">
<property name="rangChampsAffiche" type="java.lang.Integer" column="RANG"/>
<many-to-one name="champ" column="ID_CHAMPAFFICHE" class="com.orange.greco.persistance.dao.references.bean.ChampsAfficheTO"/>
</composite-element>

</set>

...
...
...

</class>



Hibernate keeps inserting and deleting composite-element linked to the MasqueTO class whenever I iterate through the corresponding link event if the linked objects are not modified.

Here is what I get into the Hibernate log :
...
( a lot of )
Hibernate: delete from MASQUECHAMP where ID_MASQUE=? and RANG=? and ID_CHAMPAFFICHE=?
Hibernate: insert into MASQUECHAMP (ID_MASQUE, RANG, ID_CHAMPAFFICHE) values (?, ?, ?)
...

This is performance killing for my application as I keep reading MasqueTO Object and browsing through MasqueChamp link

I guess my mapping is wrong but I can't find out where .

Than you by advance for your help.

Yann


Top
 Profile  
 
 Post subject: Solution
PostPosted: Tue Jun 21, 2005 12:40 pm 
Newbie

Joined: Wed Aug 25, 2004 5:41 am
Posts: 9
The solution is :

Implements hashCode and equals methods for the object mapped as composite-element.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.