org.codehaus.groovy.grails.orm.hibernate
Class GrailsSessionContext

java.lang.Object
  extended by org.codehaus.groovy.grails.orm.hibernate.GrailsSessionContext
All Implemented Interfaces:
java.io.Serializable, org.hibernate.context.spi.CurrentSessionContext

public class GrailsSessionContext
extends java.lang.Object
implements org.hibernate.context.spi.CurrentSessionContext

Based on org.springframework.orm.hibernate4.SpringSessionContext.

See Also:
Serialized Form

Field Summary
protected  boolean allowCreate
           
protected  org.hibernate.context.spi.CurrentSessionContext jtaSessionContext
           
protected  org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory
           
protected  java.lang.reflect.Constructor<?> springFlushSynchronizationConstructor
           
protected  java.lang.reflect.Constructor<?> springSessionSynchronizationConstructor
           
 
Constructor Summary
GrailsSessionContext(org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)
          Constructor.
 
Method Summary
protected  java.lang.Object create(java.lang.reflect.Constructor<?> constructor, java.lang.Object... args)
           
protected  org.springframework.transaction.support.TransactionSynchronization createSpringFlushSynchronization(org.hibernate.Session session)
           
protected  org.springframework.transaction.support.TransactionSynchronization createSpringSessionSynchronization(org.springframework.orm.hibernate4.SessionHolder sessionHolder)
           
 org.hibernate.Session currentSession()
          Retrieve the Spring-managed Session for the current thread, if any.
protected  javax.transaction.TransactionManager getJtaTransactionManager(org.hibernate.Session session)
           
 void initJta()
           
protected  java.lang.reflect.Constructor<?> lookupConstructor(java.lang.String className, java.lang.Class<?>... argTypes)
           
protected  void lookupConstructors()
           
protected  void registerJtaSynchronization(org.hibernate.Session session, org.springframework.orm.hibernate4.SessionHolder sessionHolder)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sessionFactory

protected final org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory

jtaSessionContext

protected org.hibernate.context.spi.CurrentSessionContext jtaSessionContext

springFlushSynchronizationConstructor

protected java.lang.reflect.Constructor<?> springFlushSynchronizationConstructor

springSessionSynchronizationConstructor

protected java.lang.reflect.Constructor<?> springSessionSynchronizationConstructor

allowCreate

protected boolean allowCreate
Constructor Detail

GrailsSessionContext

public GrailsSessionContext(org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)
Constructor.

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

initJta

public void initJta()

currentSession

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

Specified by:
currentSession in interface org.hibernate.context.spi.CurrentSessionContext
Throws:
org.hibernate.HibernateException

registerJtaSynchronization

protected void registerJtaSynchronization(org.hibernate.Session session,
                                          org.springframework.orm.hibernate4.SessionHolder sessionHolder)

getJtaTransactionManager

protected javax.transaction.TransactionManager getJtaTransactionManager(org.hibernate.Session session)

lookupConstructors

protected void lookupConstructors()

lookupConstructor

protected java.lang.reflect.Constructor<?> lookupConstructor(java.lang.String className,
                                                             java.lang.Class<?>... argTypes)

createSpringFlushSynchronization

protected org.springframework.transaction.support.TransactionSynchronization createSpringFlushSynchronization(org.hibernate.Session session)

createSpringSessionSynchronization

protected org.springframework.transaction.support.TransactionSynchronization createSpringSessionSynchronization(org.springframework.orm.hibernate4.SessionHolder sessionHolder)

create

protected java.lang.Object create(java.lang.reflect.Constructor<?> constructor,
                                  java.lang.Object... args)