public class SpringSessionContext extends Object implements org.hibernate.context.CurrentSessionContext
Used by Spring's LocalSessionFactoryBean
when told to expose a
transaction-aware SessionFactory. This is the default as of Spring 2.5.
This CurrentSessionContext implementation can also be specified in custom SessionFactory setup through the "hibernate.current_session_context_class" property, with the fully qualified name of this class as value.
SessionFactoryUtils.doGetSession(org.hibernate.SessionFactory, boolean)
,
AbstractSessionFactoryBean.setExposeTransactionAwareSessionFactory(boolean)
,
Serialized FormConstructor and Description |
---|
SpringSessionContext(org.hibernate.engine.SessionFactoryImplementor sessionFactory)
Create a new SpringSessionContext for the given Hibernate SessionFactory.
|
Modifier and Type | Method and Description |
---|---|
org.hibernate.classic.Session |
currentSession()
Retrieve the Spring-managed Session for the current thread, if any.
|
public SpringSessionContext(org.hibernate.engine.SessionFactoryImplementor sessionFactory)
sessionFactory
- the SessionFactory to provide current Sessions forpublic org.hibernate.classic.Session currentSession() throws org.hibernate.HibernateException
currentSession
in interface org.hibernate.context.CurrentSessionContext
org.hibernate.HibernateException
Copyright © 2015. All rights reserved.