File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Hibernate's CurrentSessionContext with Spring's Transaction Manager Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Hibernate Watch "Hibernate New topic
Author

Hibernate's CurrentSessionContext with Spring's Transaction Manager

Srinivas Kothuri
Greenhorn

Joined: Feb 08, 2010
Posts: 16
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

Joined: Mar 07, 2010
Posts: 1632
    
    7

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


[How To Ask Questions][Read before you PM me]
Srinivas Kothuri
Greenhorn

Joined: Feb 08, 2010
Posts: 16
Thank you Bill. The link you shared gave me more insight.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate's CurrentSessionContext with Spring's Transaction Manager
 
Similar Threads
Srping+Hibernate bad configurated causing huge memory consumption
Grouping oprations using HibernateDaoSupport
Spring transaction setting
problem with hibernate integration
Getting error in petclinic application for datasource