This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

New to Hibernate  RSS feed

 
lavanya Ananth
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to Hibernate and this is my first week trying to understand how it works.I would be thankful if this forum can give me good pointers and explanations to my queries.

My first block----- what is the concept behind a threadlocal variable which we use to get a session object in Hibernate?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A ThreadLocal is not a Hibernate concept, it is part of the core Java API. Basically a ThreadLocal variable is one which is local to the thread which accesses it. So if two thread access a variable, they each have their own independent copy of it i.e. changes to one doesn't affect the other.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!