-->
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: Not Able To Update
PostPosted: Thu Jan 19, 2006 12:38 am 
Beginner
Beginner

Joined: Mon Oct 17, 2005 1:58 am
Posts: 27
Every time i try to update a persistent object I am getting the Exception
"Illegal attempt to associate a collection with two open sessions"
Can any one tell me how to solve this problem?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 19, 2006 2:57 am 
Beginner
Beginner

Joined: Thu Dec 08, 2005 6:49 pm
Posts: 49
Sounds like you're not disposing of your session objects. Make sure you either call Dispose or wrap your session instances in a using clause.

Code:
using (ISession session = factory.OpenSession())
{
    //do stuff
}

If you are using VB.net pre V2, then you should manually call Dispose in a finally block.

Code:
Dim session as ISession = factory.OpenSession()
Try
    //do stuff
Finally
    session.Dispose()
End Try


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.