-->
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.  [ 6 posts ] 
Author Message
 Post subject: Illegal attempt to associate a collection with two open sess
PostPosted: Mon Dec 26, 2005 10:26 pm 
Beginner
Beginner

Joined: Thu Dec 01, 2005 12:53 am
Posts: 21
Hibernate version: 3.0


I have session-per-request in application and lazy-loading enabled... this error happens randomly when code tries to save/update a persistant object.. I doubt if its something due to concurrency b/c this happens for the object that we save into HTTP session accross request.

Anyones help will be appreciated.

Caused by: org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions
at org.hibernate.collection.AbstractPersistentCollection.setCurrentSession(AbstractPersistentCollection.java:237)
at org.hibernate.event.def.OnUpdateVisitor.processCollection(OnUpdateVisitor.java:41)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:104)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:64)
at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:58)
at org.hibernate.event.def.AbstractVisitor.process(AbstractVisitor.java:129)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:267)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:214)
at org.hibernate.event.def.DefaultUpdateEventListener.performSaveOrUpdate(DefaultUpdateEventListener.java:33)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:69)
at org.hibernate.impl.SessionImpl.update(SessionImpl.java:499)
at org.hibernate.impl.SessionImpl.update(SessionImpl.java:490)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 26, 2005 11:31 pm 
Beginner
Beginner

Joined: Tue Dec 28, 2004 11:30 am
Posts: 32
Can you post how you are opening and closing the session and where you are storing your session


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 29, 2005 6:29 am 
Beginner
Beginner

Joined: Thu Dec 01, 2005 12:53 am
Posts: 21
kkrikor

Its simple ... I am opening it in servlet filter and store it in ThreadLocal and closing it on the way back.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 01, 2006 5:42 pm 
Beginner
Beginner

Joined: Thu Dec 01, 2005 12:53 am
Posts: 21
kkrikor... didn't hear back from you !!!

Anyone can please share their thoughts on this?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 01, 2006 8:04 pm 
Beginner
Beginner

Joined: Tue Dec 28, 2004 11:30 am
Posts: 32
Ok here's another question for you ,

The hibernate Session do you put it in a thread local varaible , Are you doing that ?

Cause in my application i put the objects in the Http session too .

So let me know


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 01, 2006 11:31 pm 
Beginner
Beginner

Joined: Tue Dec 28, 2004 11:30 am
Posts: 32
and if you do the above mentioned , then check out this , you might be having concurrency problems

http://forum.hibernate.org/viewtopic.ph ... 6a4ece9adb


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