-->
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: Strategy Illegal associate collection with 2 open sessions
PostPosted: Wed Jul 13, 2011 3:09 pm 
Newbie

Joined: Fri Jun 24, 2011 2:22 pm
Posts: 4
Hi, I'm new to hibernate and I'm having a problem of Illegal attempt to associate a collection with two open sessions. I'm working with Hibernate 3.3 in JTA mode with Jboss and already configured hibernate.transaction.factory_class to org.hibernate.transaction.JTATransactionFactory and hibernate.transaction.manager_lookup_class to org.hibernate.transaction.JBossTransactionManagerLookup.

I have two session beans that can access and use the same entity at the same time. For performance reason my original idea was to keep this object in memory and reattach it with session.update when I have to use it, but I'm having this problem of Illegal attempt to associate a collection with two open sessions, cause both of the session beans appeared to have a different session automatically attach to them (because of JTA).

I tried using LockMode.UPGRADE before session.update, trying to lock the entity before using to avoid the second session bean accessing the object at the same time; but is throwing the same exception. The entity I'm using has of course a collection of objects that I suppose is generating this error.

What is the best strategy to work with this? Synchcronize access to the parent entity? Evict the object after using it?

Thanks in advance mates!!!


Top
 Profile  
 
 Post subject: Re: Strategy Illegal associate collection with 2 open sessions
PostPosted: Mon Jul 18, 2011 6:49 pm 
Newbie

Joined: Fri Jun 24, 2011 2:22 pm
Posts: 4
Sorry to reanswer, anyone knows how to do this??


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.