Package org.grails.orm.hibernate
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 Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected org.hibernate.context.spi.CurrentSessionContextprotected final org.hibernate.engine.spi.SessionFactoryImplementor -
Constructor Summary
ConstructorsConstructorDescriptionGrailsSessionContext(org.hibernate.engine.spi.SessionFactoryImplementor sessionFactory) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.transaction.support.TransactionSynchronizationcreateSpringFlushSynchronization(org.hibernate.Session session) protected org.springframework.transaction.support.TransactionSynchronizationcreateSpringSessionSynchronization(org.springframework.orm.hibernate5.SessionHolder sessionHolder) org.hibernate.SessionRetrieve the Spring-managed Session for the current thread, if any.protected jakarta.transaction.TransactionManagergetJtaTransactionManager(org.hibernate.Session session) voidinitJta()protected voidregisterJtaSynchronization(org.hibernate.Session session, org.springframework.orm.hibernate5.SessionHolder sessionHolder)
-
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.HibernateExceptionRetrieve the Spring-managed Session for the current thread, if any.- Specified by:
currentSessionin interfaceorg.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)
-