This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Tutorial Chapter 1 Problem

 
kayanaat sidiqui
Ranch Hand
Posts: 122
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to all,
Well i am reading hibernate 3.2.2 tutorial.
Going through these web pages i came to know that we should use session as "Thread Bound Programming" that means one session per thread.
But when i was going through 1.3.3(Working the association), there is concept of detached objects and hence session opened and closed twice as per requirement. I want to know is it again one session per thread or what?

Thanks in advance.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup, even though you're opening and closing Sessions, you still have the Hibernate Session itself bound to the thread, or ThreadLocal context.

-Cameron McKenzie
 
Ketan Parekh
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not able to open scja.com
 
ntumba lobo
Ranch Hand
Posts: 180
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Yup, even though you're opening and closing Sessions, you still have the Hibernate Session itself bound to the thread, or ThreadLocal context.


From HibernateUtil.java



That means when we close a hibernate session, the session is not kept in the threadLocal with threadSession.set(null); , or I misunderstand something...
[ October 28, 2008: Message edited by: ntumba lobo ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic