Class 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

      Fields 
      Modifier and Type Field Description
      protected boolean allowCreate  
      protected org.hibernate.context.spi.CurrentSessionContext jtaSessionContext  
      protected org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory  
    • Constructor Summary

      Constructors 
      Constructor Description
      GrailsSessionContext​(org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.springframework.transaction.support.TransactionSynchronization createSpringFlushSynchronization​(org.hibernate.Session session)  
      protected org.springframework.transaction.support.TransactionSynchronization createSpringSessionSynchronization​(org.springframework.orm.hibernate5.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 void registerJtaSynchronization​(org.hibernate.Session session, org.springframework.orm.hibernate5.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
      • 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.hibernate5.SessionHolder sessionHolder)
      • getJtaTransactionManager

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

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

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