• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Hibernate Tutorial Chapter 1 Problem

 
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author and cow tipper
Posts: 5000
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not able to open scja.com
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic