Class ContextManagerAdapter
java.lang.Object
ch.tocco.nice2.persist.core.impl.hibernate.legacy.ContextManagerAdapter
- All Implemented Interfaces:
ContextManager
Manages and creates
Context instances.
At most one Context can be bound to a thread at the same time.
The 'current' session/context is defined by the SessionFactoryManager (which in turn
uses the ManagedSessionContext to store the current session).-
Constructor Summary
ConstructorsConstructorDescriptionContextManagerAdapter(TypeManager typeManager, SessionFactoryManager sessionFactoryManager, PersistenceService persistService, NiceDataModel dataModel, QueryCompiler queryCompiler) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidClear and close the implicit context.Create a new context and attach it to the current thread.createNewContext(Integer queryTimeout) createNewContext(Connection connection) Create a new context using an existing connection.createNewContext(Connection connection, Integer socketTimeout) voidsetThreadContext(@Nullable Context ctx) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ch.tocco.nice2.persist.core.api.ContextManager
newContext
-
Constructor Details
-
ContextManagerAdapter
public ContextManagerAdapter(TypeManager typeManager, @Lazy SessionFactoryManager sessionFactoryManager, @Lazy PersistenceService persistService, @Lazy NiceDataModel dataModel, @Lazy QueryCompiler queryCompiler)
-
-
Method Details
-
createNewContext
Description copied from interface:ContextManagerCreate a new context and attach it to the current thread.- Specified by:
createNewContextin interfaceContextManager
-
createNewContext
- Specified by:
createNewContextin interfaceContextManager
-
createNewContext
Description copied from interface:ContextManagerCreate a new context using an existing connection. This can be useful in special circumstances when a context needs to use the same transaction as an already existing connection. Note: The connection is not closed when the context is closed!- Specified by:
createNewContextin interfaceContextManager
-
createNewContext
- Specified by:
createNewContextin interfaceContextManager
-
setThreadContext
- Specified by:
setThreadContextin interfaceContextManager
-
getThreadContext
- Specified by:
getThreadContextin interfaceContextManager
-
clearImplicitContext
public void clearImplicitContext()Description copied from interface:ContextManagerClear and close the implicit context. Should be called at the end of a test or request. Can also called when the implicit context is no longer needed to release the database connection.- Specified by:
clearImplicitContextin interfaceContextManager
-
addContextCreationListener
- Specified by:
addContextCreationListenerin interfaceContextManager
-
removeContextCreationListener
- Specified by:
removeContextCreationListenerin interfaceContextManager
-