-->
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.  [ 1 post ] 
Author Message
 Post subject: [getCurrentSession] Same thread different session
PostPosted: Tue Aug 10, 2010 8:56 am 
Beginner
Beginner

Joined: Sun Apr 25, 2010 7:14 am
Posts: 30
Hi,

i have a strange problem in my hibernate application. It is a web application but i don't think that this does matter
according to my problem.

The problem ist that getCurrentSession() of the SessionFactory returns different Session objects although i am
within the same thread and use ThreadLocalSessionContext. Here some debug output:

Code:
28 getSessionFactory 989823897
28 getSessionFactory 989823897
28 filter start: 510975463
28 getSessionFactory 989823897
28 getSessionFactory 989823897
28 before site action: 510975463
28 site action start: 759932786
28 site action end: 759932786
28 getSessionFactory 989823897
28 getSessionFactory 989823897
28 after site action: 510975463
28 getSessionFactory 989823897
28 getSessionFactory 989823897
28 filter end: 510975463

The first figure is the thread id and as you can see i am within the same thread all the time. The figure
following "getSessionFactory" is the hash code of the session factory that is (as expected) always the same.
The other figures are the hash codes fo the returned Session objects. At some point in my program i
get a different Session object from the same SessionFactory although still being in the same thread. This point is
nothing special... just a simple method call. After returning from this method i get back my "old" Session
object.

I don't know how this can happen... has anybody of you any clue? Thanks a lot!

Yours
Thomas


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.