站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.0.5 API 文档英文版

SpringSessionContext (Spring Framework API 2.0) - Spring Framework 2.0.5 API 文档英文版

The Spring Framework

org.springframework.orm.hibernate3
Class SpringSessionContext

java.lang.Object
  extended by org.springframework.orm.hibernate3.SpringSessionContext
All Implemented Interfaces:
Serializable, CurrentSessionContext

public class SpringSessionContext
extends Object
implements CurrentSessionContext

Implementation of Hibernate 3.1's CurrentSessionContext interface that delegates to Spring's SessionFactoryUtils for providing a Spring-managed current Session.

Used by Spring's LocalSessionFactoryBean if told to not expose a transaction-aware SessionFactory proxy. LocalSessionFactoryBean's default is still SessionFactory proxying, though, mainly to remain compatible with Hibernate 3.0 as well. Turn the "exposeTransactionAwareSessionFactory" flag to "false" to expose the raw Hibernate 3.1 CurrentSessionContext mechanism.

This CurrentSessionContext implementation can be specified in custom SessionFactory setup through the "hibernate.current_session_context_class" property, with the fully qualified name of this class as value.

Since:
2.0
Author:
Juergen Hoeller
See Also:
SessionFactoryUtils.doGetSession(org.hibernate.SessionFactory, boolean), AbstractSessionFactoryBean.setExposeTransactionAwareSessionFactory(boolean), Serialized Form

Constructor Summary
SpringSessionContext(SessionFactoryImplementor sessionFactory)
          Create a new SpringSessionContext for the given Hibernate SessionFactory.
 
Method Summary
 Session currentSession()
          Retrieve the Spring-managed Session for the current thread, if any.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringSessionContext

public SpringSessionContext(SessionFactoryImplementor sessionFactory)
Create a new SpringSessionContext for the given Hibernate SessionFactory.

Parameters:
sessionFactory - the SessionFactory to provide current Sessions for
Method Detail

currentSession

public Session currentSession()
                       throws HibernateException
Retrieve the Spring-managed Session for the current thread, if any.

Specified by:
currentSession in interface CurrentSessionContext
Throws:
HibernateException

The Spring Framework

Copyright © 2002-2007 The Spring Framework.