-->
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: how to remove collections refs from cache
PostPosted: Thu May 04, 2006 2:15 pm 
Newbie

Joined: Tue Sep 27, 2005 8:12 am
Posts: 12
Hi,

I am having bit of trouble saving objects (objects contains collection of another objects and hibernate's uuid is used for id) in another hibernate session. (sessions points to different database and objects need different ids in each database)

I save objects in one hibernate session then I call:
session1.clear();
session1.close();
sessionFactory1.close();

After that I initialize second session factory and opens new session from it.
If I call save now, I get error:

org.hibernate.HibernateException: Don't change the reference to a collection with cascade="all-delete-orphan":

But before calling save in session2, if I call
session2.clear();
Then I get error:
org.hibernate.HibernateException: Found two representations of same collection:

As from doc it looks that session.clear() clears the first level cache and sessionFactory.close() removes second level cache (if any). Any idea whats going on?
As this is a new session, so I don't think that this ( http://forum.hibernate.org/viewtopic.ph ... highlight= ) should apply in my case.

Any suggestions?

Thanks.

Hibernate version:3.1.2


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 05, 2006 10:13 am 
Newbie

Joined: Tue Sep 27, 2005 8:12 am
Posts: 12
At the moment made it working by replicating the objects in memory before calling save in another session. But there should be no need (I think) of this after clearing the cache.


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.