Class MicronautSessionContext

java.lang.Object
io.micronaut.transaction.hibernate.MicronautSessionContext
All Implemented Interfaces:
Serializable, org.hibernate.context.spi.CurrentSessionContext

public class MicronautSessionContext extends Object implements org.hibernate.context.spi.CurrentSessionContext
Implementation of Hibernate 3.1's CurrentSessionContext interface that delegates to ConnectionOperations for providing a current Session.

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.

Since:
4.0.0
Author:
graemerocher, Denis Stepanov
See Also:
  • Constructor Details

    • MicronautSessionContext

      public MicronautSessionContext(org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory)
      Create a new MicronautSessionContext for the given SessionFactoryImplementor.
      Parameters:
      sessionFactory - the SessionFactoryImplementor
  • Method Details

    • currentSession

      public org.hibernate.Session currentSession() throws org.hibernate.HibernateException
      Specified by:
      currentSession in interface org.hibernate.context.spi.CurrentSessionContext
      Throws:
      org.hibernate.HibernateException