-->
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: problem with ehcache & bidir. many-to-many association
PostPosted: Wed May 10, 2006 1:39 pm 
Newbie

Joined: Sat Aug 27, 2005 1:08 pm
Posts: 4
Hi,
i found very particular case in which it looks that ehcache is not working

i am using hibernate 3.1.3

i have a many-to-many bidirectional association like this

User.hbm.xml
Code:
      <set name="things" table="user_thing" cascade="save-update" sort="natural" lazy="true">
         <cache usage="read-write"/>
         <key column="id_user" />
         <many-to-many class="xx.data.dto.Thing" column="id_thing" />
      </set>


Thing.hbm.xml
Code:
      <set name="users" table="user_thing" cascade="save-update" sort="natural" lazy="false" inverse="true">
         <cache usage="read-write"/>
         <key column="id_thing" />
         <many-to-many class="xx.data.dto.User" column="id_user" />
      </set>


i remove a Thing from a User with this User method
Code:
   public void removeThing(Thing thing) {
      things.remove(thing);
      thing.getUsers().remove(this);
   }


if i print the things set after the remove, it looks ok.

but if i access later the inverse side of the mapping (loading a Thing and getting aThing.getUsers()), the removed item is still there.

if i comment the cache on the inverse side, everything it works

Code:
<!--<cache usage="read-write"/>-->


it only happens with remove, many-to-many and on the inverse side.

any idea ?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 10, 2006 2:51 pm 
Regular
Regular

Joined: Wed Jul 27, 2005 2:33 am
Posts: 118
Have a look at:

http://www.hibernate.org/117.html#A32

which means you will have to manually remove the associated collections from cache.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 10, 2006 3:58 pm 
Newbie

Joined: Sat Aug 27, 2005 1:08 pm
Posts: 4
jaikiran wrote:
Have a look at:

http://www.hibernate.org/117.html#A32

which means you will have to manually remove the associated collections from cache.

thanks but it does not say that i must remove the collection from cache; it says "You must remove the deleted object from all collections it belongs to." and i did it.


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.