Class GrailsSessionContext

java.lang.Object
org.grails.orm.hibernate.GrailsSessionContext
All Implemented Interfaces:
Serializable, org.hibernate.context.spi.CurrentSessionContext

public class GrailsSessionContext extends Object implements org.hibernate.context.spi.CurrentSessionContext
Based on org.springframework.orm.hibernate4.SpringSessionContext.
See Also:
  • Field Details

    • sessionFactory

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

      protected org.hibernate.context.spi.CurrentSessionContext jtaSessionContext
    • allowCreate

      protected boolean allowCreate
  • Constructor Details

    • GrailsSessionContext

      public GrailsSessionContext(org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)
      Constructor.
      Parameters:
      sessionFactory - the SessionFactory to provide current Sessions for
  • Method Details

    • 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 jakarta.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)