Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Teneo: Issue with multiple sessions(Teneo: Issue with multiple sessions)
Teneo: Issue with multiple sessions [message #1228001] Mon, 06 January 2014 07:19 Go to next message
Chandre Gowda is currently offline Chandre GowdaFriend
Messages: 56
Registered: April 2013
Member
Hello,
I have set following property while initializing datastore.
"hibernate.current_session_context_class", "org.hibernate.context.internal.ThreadLocalSessionContext"

And I always get session using sessionfactory.getCurrentSession() and doesn't handle session.close as I assume it's the responsibility of the framework.

But whenever I try to update the object, get following error
'org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions'. Could you please tell me what are the possible sources of this problem?

Thanks
Chandru
Re: Teneo: Issue with multiple sessions [message #1228016 is a reply to message #1228001] Mon, 06 January 2014 07:50 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Chandre,
Google is your friend, apparently there are 2 sessions, in one session you read the object, in the other session you try
to update this same object.

Just setting the threadlocalsessioncontext will not close the session, except if you run in some jpa2 container
environment (which often is way to heavy). So you need to close your session yourselve. In web apps there is the nice
'open session in view' pattern, not sure what the best way in RCP's is. But maybe the open session in view pattern
provides insights for that environment to.

gr. Martin

On 01/06/2014 08:19 AM, Chandre Gowda wrote:
> Hello,
> I have set following property while initializing datastore.
> "hibernate.current_session_context_class", "org.hibernate.context.internal.ThreadLocalSessionContext"
>
> And I always get session using sessionfactory.getCurrentSession() and doesn't handle session.close as I assume it's the
> responsibility of the framework.
>
> But whenever I try to update the object, get following error
> 'org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions'. Could you please
> tell me what are the possible sources of this problem?
>
> Thanks
> Chandru


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Previous Topic:[CDO] Open Resource Dialog
Next Topic:Teneo: Issue with Merge()
Goto Forum:
  


Current Time: Tue Apr 23 08:37:11 GMT 2024

Powered by FUDForum. Page generated in 0.03033 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top