-->
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: Solutions to "attempt to associate a collection with tw
PostPosted: Tue Oct 07, 2003 10:32 am 
Regular
Regular

Joined: Tue Sep 16, 2003 11:35 am
Posts: 93
Location: San Francisco, CA
I know that this issue has come up before on Hibernate message boards but I still haven't come across any possible solution. The problem is intermittent errors of the type:

net.sf.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions

e.g. http://www.mail-archive.com/hibernate-d ... 02239.html

in a multi-user tomcat application using Hibernate. I'm terribly worried that this is happening because of concurrent access to the same data by different requests. If so, this must be a problem that other people have encountered since it seems to be a serious impediment to the scalability of Hibernate.

So my questions are:

1. Is this a general problem and is it likely my problem or is it more likely that there is a bug in my code that forgets to close a Session?
2. What solutions have people found for limiting concurrent access to the same persisted data? I'm worried that I have to write an entire layer of logic to prevent this from happening.

Thanks for you help,

Jesse


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 07, 2003 10:56 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
It's not a concurrent access to persistent data.
You're trying to attach the same java instance of collection into 2 different sessions.
Are you sharing collection java instance between users ?
If you have to, implements the clone() method and use it.


Top
 Profile  
 
 Post subject: Let's see
PostPosted: Tue Oct 07, 2003 11:11 am 
Regular
Regular

Joined: Tue Sep 16, 2003 11:35 am
Posts: 93
Location: San Francisco, CA
So ... this is a relief ... you say it's actually the java instance of a collection being shared. So really the only way that I could be getting this bug is one of:

1. a request has more than one session and I'm accidently sharing things between them
2. something stored in the session context or application context is being shared between different concurrent sessions
3. static data is shared between two sessions

there is hope, thanks a lot


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.