|
Re: Teneo: Issue with multiple sessions [message #1228016 is a reply to message #1228001] |
Mon, 06 January 2014 07:50 |
Martin Taal 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
|
|
|
Powered by
FUDForum. Page generated in 0.03649 seconds