Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate's CurrentSessionContext with Spring's Transaction Manager

 
Srinivas Kothuri
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm curious to know how Hibernate's 'current_session_context_class' declaration will disable the Spring's HibernateTransactionManager?



I found that the above two can not exist together for same SessionFactory.
Kindly ley me know what is the role of Spring's HibernateTransactionManager in defining scope for Hibernate's Session context?

 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does this thread help at all?
http://www.coderanch.com/t/590071/ORM/databases/org-hibernate-SessionException-Session-closed

What Spring does is it creates an instance of SpringSessionContext which allows you to retrieve the spring managed session for the current thread if it exists. If you want your session factory to be transaction aware this is required. By providing your own value for this property you are overriding this behavior.

See the java doc for

setExposeTransactionAwareSessionFactory on the AbstractSessionFactoryBean
 
Srinivas Kothuri
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Bill. The link you shared gave me more insight.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic