Class SharedSessionDelegatorBaseImpl
- java.lang.Object
-
- org.hibernate.engine.spi.SharedSessionDelegatorBaseImpl
-
- All Implemented Interfaces:
Closeable,Serializable,AutoCloseable,LobCreationContext,SharedSessionContractImplementor,QueryProducer,QueryProducerImplementor,JdbcSessionOwner,TransactionCoordinatorBuilder.Options,SharedSessionContract,JavaType.CoercionContext,WrapperOptions
public class SharedSessionDelegatorBaseImpl extends Object implements SharedSessionContractImplementor
A wrapper class that delegates all method invocations to a delegate instance ofSharedSessionContractImplementor. This is useful for custom implementations of that API, so that only some methods need to be overridden- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.hibernate.engine.jdbc.LobCreationContext
LobCreationContext.Callback<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected SharedSessionContractImplementordelegate
-
Constructor Summary
Constructors Constructor Description SharedSessionDelegatorBaseImpl(SessionImplementor delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TransactionaccessTransaction()Retrieves the currentTransaction, or creates a new transaction if there is no transaction active.voidafterOperation(boolean success)Check if there is a Hibernate or JTA transaction in progress and, if there is not, flush if necessary, making sure that the connection has been committed (if it is not in autocommit mode), and finally run the after completion processing.voidafterScrollOperation()Called after each operation on aScrollableResults, providing an opportunity for a stateless session to clear its temporary persistence context.voidafterTransactionBegin()A after-begin callback from the coordinator to its owner.voidafterTransactionCompletion(boolean successful, boolean delayed)An after-completion callback to the owner.booleanautoFlushIfRequired(Set<String> querySpaces)detect in-memory changes, determine if the changes are to tables named in the query and, if so, complete execution the flushbooleanautoFlushIfRequired(Set<String> querySpaces, boolean skipPreFlush)voidautoPreFlush()voidbeforeTransactionCompletion()A before-completion callback to the owner.TransactionbeginTransaction()Begin a unit of work and return the associatedTransactionobject.StringbestGuessEntityName(Object object)Obtain the best estimate of the entity name of the given entity instance, which is not involved in an association, by also considering information held in the proxy, and whether the object is already associated with this session.voidcheckOpen(boolean markForRollbackIfClosed)Check whether the session is open, and if not: ifmarkForRollbackIfClosed = true, mark the current transaction, if any, for rollback only, and throw anIllegalStateException.voidclose()End the session by releasing the JDBC connection and cleaning up.<T> RootGraph<T>createEntityGraph(Class<T> rootType)Create a new mutableEntityGraphwith only a root node.<T> RootGraph<T>createEntityGraph(Class<T> rootType, String graphName)Create a new mutable copy of the namedEntityGraph, or returnnullif there is no graph with the given name.RootGraph<?>createEntityGraph(String graphName)Create a new mutable copy of the namedEntityGraph, or returnnullif there is no graph with the given name.MutationQuerycreateMutationQuery(CriteriaDelete deleteQuery)Create aMutationQueryfrom the given delete criteria treeMutationQuerycreateMutationQuery(CriteriaUpdate updateQuery)Create aMutationQueryfrom the given update criteria treeMutationQuerycreateMutationQuery(String statementString)Create aMutationQueryreference for the given HQL insert, update, or delete statement.MutationQuerycreateMutationQuery(JpaCriteriaInsert insertSelect)Create aMutationQueryfrom the given insert criteria treeMutationQuerycreateMutationQuery(JpaCriteriaInsertSelect insertSelect)Create aMutationQueryfrom the given insert-select criteria treeMutationQuerycreateNamedMutationQuery(String name)Create aMutationQueryinstance for the given named insert, update, or delete HQL query.QueryImplementorcreateNamedQuery(String name)Create a typedQueryinstance for the given named query.<T> QueryImplementor<T>createNamedQuery(String name, Class<T> resultClass)Create a typedQueryinstance for the given named query.SelectionQuery<?>createNamedSelectionQuery(String name)Create aSelectionQueryinstance for the namedNamedQuery.<R> SelectionQuery<R>createNamedSelectionQuery(String name, Class<R> resultType)Create aSelectionQueryinstance for the namedNamedQuerywith the given result type.ProcedureCallcreateNamedStoredProcedureQuery(String name)Obtain aProcedureCallbased on a named templateMutationQuerycreateNativeMutationQuery(String sqlString)Create aNativeQueryinstance for the given native SQL statement.NativeQueryImplementorcreateNativeQuery(String sqlString)Create aNativeQueryinstance for the given native SQL query.NativeQueryImplementorcreateNativeQuery(String sqlString, Class resultClass)Create aNativeQueryinstance for the given native SQL query using an implicit mapping to the specified Java type.<T> NativeQueryImplementor<T>createNativeQuery(String sqlString, Class<T> resultClass, String tableAlias)Create aNativeQueryinstance for the given native SQL query using an implicit mapping to the specified Java entity type.NativeQueryImplementorcreateNativeQuery(String sqlString, String resultSetMappingName)Create aNativeQueryinstance for the given native SQL query using an explicit mapping to the specified Java type.<T> NativeQueryImplementor<T>createNativeQuery(String sqlString, String resultSetMappingName, Class<T> resultClass)Create aNativeQueryinstance for the given native SQL query using an explicit mapping to the specified Java type.QueryImplementorcreateQuery(CriteriaDelete deleteQuery)Create aMutationQueryfor the given JPACriteriaDelete<T> QueryImplementor<T>createQuery(CriteriaQuery<T> criteriaQuery)Create aQueryfor the given JPACriteriaQuery.QueryImplementorcreateQuery(CriteriaUpdate updateQuery)Create aMutationQueryfor the given JPACriteriaUpdateQueryImplementorcreateQuery(String queryString)Create aQueryinstance for the given HQL query, or HQL insert, update, or delete statement.<T> QueryImplementor<T>createQuery(String queryString, Class<T> resultType)Create a typedQueryinstance for the given HQL query string and given query result type.<R> SelectionQuery<R>createSelectionQuery(CriteriaQuery<R> criteria)Create aSelectionQueryreference for the givenCriteriaQuery.SelectionQuery<?>createSelectionQuery(String hqlString)Create aSelectionQueryreference for the given HQLselectstatement.<R> SelectionQuery<R>createSelectionQuery(String hqlString, Class<R> resultType)Create aSelectionQueryinstance for the given HQL query string and given query result type.ProcedureCallcreateStoredProcedureCall(String procedureName)Create aProcedureCallto a stored procedure.ProcedureCallcreateStoredProcedureCall(String procedureName, Class<?>... resultClasses)Create aProcedureCallto a stored procedure with the given result set entity mappings.ProcedureCallcreateStoredProcedureCall(String procedureName, String... resultSetMappings)Create aProcedureCallto a stored procedure with the given result set entity mappings.ProcedureCallcreateStoredProcedureQuery(String procedureName)Create aProcedureCallto a stored procedure.ProcedureCallcreateStoredProcedureQuery(String procedureName, Class<?>... resultClasses)Create aProcedureCallto a stored procedure with the given result set entity mappings.ProcedureCallcreateStoredProcedureQuery(String procedureName, String... resultSetMappings)Create aProcedureCallto a stored procedure with the given result set entity mappings.protected SharedSessionContractdelegate()Returns the delegate session.voiddisableFilter(String filterName)Disable the named filter for the current session.<T> TdoReturningWork(ReturningWork<T> work)Perform work using theConnectionunderlying by this session, and return a result.voiddoWork(Work work)Perform work using theConnectionunderlying by this session.FilterenableFilter(String filterName)Enable the named filter for this current session.<T> Texecute(LobCreationContext.Callback<T> callback)Execute the given callback, making sure it has access to a viable JDBCConnection.voidflush()Flush this session.voidflushBeforeTransactionCompletion()EntityKeygenerateEntityKey(Object id, EntityPersister persister)Instantiate anEntityKeywith the given id and for the entity represented by the givenEntityPersister.CacheModegetCacheMode()Get the currentCacheModefor this session.CacheTransactionSynchronizationgetCacheTransactionSynchronization()The currentCacheTransactionSynchronizationassociated with this session.ObjectgetContextEntityIdentifier(Object object)Return the identifier of the persistent object, or null if it is not associated with this session.HibernateCriteriaBuildergetCriteriaBuilder()FiltergetEnabledFilter(String filterName)Retrieve a currently enabled filter by name.RootGraph<?>getEntityGraph(String graphName)Retrieve the namedEntityGraphas an immutable graph, or returnnullif there is no graph with the given name.<T> List<EntityGraph<? super T>>getEntityGraphs(Class<T> entityClass)Retrieve all namedEntityGraphs with the given type.EntityPersistergetEntityPersister(@Nullable String entityName, Object object)Get theEntityPersisterfor the given entity instance.ObjectgetEntityUsingInterceptor(EntityKey key)Get the entity instance associated with the givenEntityKey, calling theInterceptorif necessary.SessionEventListenerManagergetEventListenerManager()Get theSessionEventListenerManagerassociated with this session.EventManagergetEventManager()ExceptionConvertergetExceptionConverter()Obtain anExceptionConverterfor reporting an error.SessionFactoryImplementorgetFactory()Obtain the factory which created this session.FlushModeTypegetFlushMode()Get the currentFlushModeTypefor this session.FlushModegetHibernateFlushMode()Get the currentFlushModefor this session.InterceptorgetInterceptor()Retrieves theInterceptorassociated with this session.IntegergetJdbcBatchSize()Get the session-level JDBC batch size for the current session.JdbcConnectionAccessgetJdbcConnectionAccess()JdbcCoordinatorgetJdbcCoordinator()Obtain theJdbcCoordinatorfor this session.JdbcServicesgetJdbcServices()Obtain theJdbcServicesfor the factory which created this session.JdbcSessionContextgetJdbcSessionContext()TimeZonegetJdbcTimeZone()The JDBCTimeZoneused when writing a value of typeTimeorTimestampto a JDBCPreparedStatement, or when reading from a JDBCResultSet.LoadQueryInfluencersgetLoadQueryInfluencers()Get theLoadQueryInfluencersassociated with this session.LobCreatorgetLobCreator()Obtain access to theLobCreator.NativeQueryImplementorgetNamedNativeQuery(String name)Get aNativeQueryinstance for a named native SQL queryNativeQueryImplementorgetNamedNativeQuery(String name, String resultSetMapping)Get aNativeQueryinstance for a named native SQL queryProcedureCallgetNamedProcedureCall(String name)Obtain aProcedureCallbased on a named templateQueryImplementorgetNamedQuery(String name)Create aQueryinstance for the named query.booleangetNativeJdbcParametersIgnored()PersistenceContextgetPersistenceContext()Get the persistence context for this session.PersistenceContextgetPersistenceContextInternal()Similar toSharedSessionContractImplementor.getPersistenceContext(), with two differences: this version performs better as it allows for inlining and probably better prediction, and it skips some checks of the current state of the session.intgetPreferredSqlTypeCodeForBoolean()The JDBCtype codeused to bind a null boolean value.UUIDgetSessionIdentifier()Obtain aUUIDwhich uniquely identifies this session.StringgetTenantIdentifier()Obtain the tenant identifier associated with this session.ObjectgetTenantIdentifierValue()Obtain the tenant identifier associated with this session.TransactiongetTransaction()Get theTransactioninstance associated with this session.TransactionCoordinatorgetTransactionCoordinator()Obtain the builder for TransactionCoordinator instancesStringguessEntityName(Object entity)Obtain an estimate of the entity name of the given entity instance, which is not involved in an association, using only theEntityNameResolver.ObjectimmediateLoad(String entityName, Object id)Load an instance immediately.voidinitializeCollection(PersistentCollection<?> collection, boolean writing)Initialize the given collection (if not already initialized).Objectinstantiate(String entityName, Object id)Instantiate the entity class, initializing with the given identifier.Objectinstantiate(EntityPersister persister, Object id)Instantiate the entity class of the givenEntityPersister, initializing the new instance with the given identifier.ObjectinternalLoad(String entityName, Object id, boolean eager, boolean nullable)Obtain an entity instance with the given id, without checking if it was deleted or scheduled for deletion.booleanisAutoCloseSessionEnabled()Is auto-close at transaction completion enabled?booleanisClosed()Determines whether the session is closed.booleanisConnected()Check if the session is currently connected.booleanisCriteriaCopyTreeEnabled()booleanisDefaultReadOnly()Are entities and proxies loaded by this session read-only by default?booleanisJoinedToTransaction()Check if the session is joined to the current transaction.booleanisOpen()Check if the session is still open.booleanisTransactionInProgress()Does this session have an active Hibernate transaction, or is it associated with a JTA transaction currently in progress?voidjoinTransaction()Join the currently-active JTA transaction.voidmarkForRollbackOnly()Marks current transaction, if any, for rollback only.voidprepareForQueryExecution(boolean requiresTxn)Prepare for the execution of aQueryorProcedureCallvoidsetAutoClear(boolean enabled)Enable or disable automatic cache clearing from after transaction completion.voidsetCacheMode(CacheMode cm)Set the currentCacheModefor this session.voidsetCriteriaCopyTreeEnabled(boolean jpaCriteriaCopyComplianceEnabled)voidsetHibernateFlushMode(FlushMode flushMode)Set the currentFlushModefor this session.voidsetJdbcBatchSize(Integer jdbcBatchSize)Set the session-level JDBC batch size.voidsetNativeJdbcParametersIgnored(boolean nativeJdbcParametersIgnored)booleanshouldAutoClose()Should this session be automatically closed after the current transaction completes?booleanshouldAutoJoinTransaction()Indicates whether an active transaction should be automatically joined.voidstartTransactionBoundary()Callback indicating recognition of entering into a transactional context whether that is explicitly via the HibernateTransactionAPI or via registration of Hibernate's JTA Synchronization impl with a JTA TransactionbooleanuseStreamForLobBinding()Determines whether streams should be used for binding LOB values.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.resource.jdbc.spi.JdbcSessionOwner
getSqlExceptionHelper
-
Methods inherited from interface org.hibernate.engine.jdbc.LobCreationContext
fromContext
-
Methods inherited from interface org.hibernate.engine.spi.SharedSessionContractImplementor
asEventSource, asSessionImplementor, asStatelessSession, bestGuessEntityName, checkOpen, checkTransactionNeededForUpdateOperation, getConfiguredJdbcBatchSize, getSession, getSessionFactory, getSessionToken, getTypeConfiguration, isEnforcingFetchGraph, isEventSource, isOpenOrWaitingForAutoClose, isSessionImplementor, isStatelessSession, setEnforcingFetchGraph
-
Methods inherited from interface org.hibernate.type.descriptor.WrapperOptions
getDialect
-
-
-
-
Field Detail
-
delegate
protected final SharedSessionContractImplementor delegate
-
-
Constructor Detail
-
SharedSessionDelegatorBaseImpl
public SharedSessionDelegatorBaseImpl(SessionImplementor delegate)
-
-
Method Detail
-
delegate
protected SharedSessionContract delegate()
Returns the delegate session.
-
getTenantIdentifier
public String getTenantIdentifier()
Description copied from interface:SharedSessionContractObtain the tenant identifier associated with this session.- Specified by:
getTenantIdentifierin interfaceSharedSessionContract- Returns:
- The tenant identifier associated with this session, or
null
-
getTenantIdentifierValue
public Object getTenantIdentifierValue()
Description copied from interface:SharedSessionContractObtain the tenant identifier associated with this session.- Specified by:
getTenantIdentifierValuein interfaceSharedSessionContract- Returns:
- The tenant identifier associated with this session, or
null
-
createMutationQuery
public MutationQuery createMutationQuery(CriteriaUpdate updateQuery)
Description copied from interface:QueryProducerCreate aMutationQueryfrom the given update criteria tree- Specified by:
createMutationQueryin interfaceQueryProducer- Specified by:
createMutationQueryin interfaceQueryProducerImplementor
-
createMutationQuery
public MutationQuery createMutationQuery(CriteriaDelete deleteQuery)
Description copied from interface:QueryProducerCreate aMutationQueryfrom the given delete criteria tree- Specified by:
createMutationQueryin interfaceQueryProducer- Specified by:
createMutationQueryin interfaceQueryProducerImplementor
-
createMutationQuery
public MutationQuery createMutationQuery(JpaCriteriaInsertSelect insertSelect)
Description copied from interface:QueryProducerCreate aMutationQueryfrom the given insert-select criteria tree- Specified by:
createMutationQueryin interfaceQueryProducer
-
createMutationQuery
public MutationQuery createMutationQuery(JpaCriteriaInsert insertSelect)
Description copied from interface:QueryProducerCreate aMutationQueryfrom the given insert criteria tree- Specified by:
createMutationQueryin interfaceQueryProducer
-
createQuery
public <T> QueryImplementor<T> createQuery(CriteriaQuery<T> criteriaQuery)
Description copied from interface:QueryProducerCreate aQueryfor the given JPACriteriaQuery.- Specified by:
createQueryin interfaceQueryProducer- Specified by:
createQueryin interfaceQueryProducerImplementor
-
createQuery
public QueryImplementor createQuery(CriteriaUpdate updateQuery)
Description copied from interface:QueryProducerCreate aMutationQueryfor the given JPACriteriaUpdate- Specified by:
createQueryin interfaceQueryProducer- Specified by:
createQueryin interfaceQueryProducerImplementor
-
createQuery
public QueryImplementor createQuery(CriteriaDelete deleteQuery)
Description copied from interface:QueryProducerCreate aMutationQueryfor the given JPACriteriaDelete- Specified by:
createQueryin interfaceQueryProducer- Specified by:
createQueryin interfaceQueryProducerImplementor
-
getNamedQuery
public QueryImplementor getNamedQuery(String name)
Description copied from interface:QueryProducerCreate aQueryinstance for the named query.- Specified by:
getNamedQueryin interfaceQueryProducer- Specified by:
getNamedQueryin interfaceQueryProducerImplementor- Parameters:
name- the name of a predefined named query- Returns:
- The
Queryinstance for manipulation and execution
-
getNamedNativeQuery
public NativeQueryImplementor getNamedNativeQuery(String name)
Description copied from interface:QueryProducerGet aNativeQueryinstance for a named native SQL query- Specified by:
getNamedNativeQueryin interfaceQueryProducer- Specified by:
getNamedNativeQueryin interfaceQueryProducerImplementor- Parameters:
name- The name of the predefined query- Returns:
- The
NativeQueryinstance for manipulation and execution
-
getNamedNativeQuery
public NativeQueryImplementor getNamedNativeQuery(String name, String resultSetMapping)
Description copied from interface:QueryProducerGet aNativeQueryinstance for a named native SQL query- Specified by:
getNamedNativeQueryin interfaceQueryProducer- Specified by:
getNamedNativeQueryin interfaceQueryProducerImplementor- Parameters:
name- The name of the predefined query- Returns:
- The
NativeQueryinstance for manipulation and execution
-
createQuery
public QueryImplementor createQuery(String queryString)
Description copied from interface:QueryProducerCreate aQueryinstance for the given HQL query, or HQL insert, update, or delete statement.If a query has no explicit
selectlist, the select list is inferred:- if there is exactly one root entity in the
fromclause, then that root entity is the only element of the select list, or - otherwise, if there are multiple root entities in the
fromclause, then the select list contains every root entity and every non-fetchjoined entity.
- Specified by:
createQueryin interfaceQueryProducer- Specified by:
createQueryin interfaceQueryProducerImplementor- Parameters:
queryString- The HQL query- Returns:
- The
Queryinstance for manipulation and execution - See Also:
EntityManager.createQuery(String)
- if there is exactly one root entity in the
-
createSelectionQuery
public SelectionQuery<?> createSelectionQuery(String hqlString)
Description copied from interface:QueryProducerCreate aSelectionQueryreference for the given HQLselectstatement.If the statement has no explicit
selectlist, the select list is inferred:- if there is exactly one root entity in the
fromclause, then that root entity is the only element of the select list, or - otherwise, if there are multiple root entities in the
fromclause, then the select list contains every root entity and every non-fetchjoined entity.
- Specified by:
createSelectionQueryin interfaceQueryProducer
- if there is exactly one root entity in the
-
createSelectionQuery
public <R> SelectionQuery<R> createSelectionQuery(String hqlString, Class<R> resultType)
Description copied from interface:QueryProducerCreate aSelectionQueryinstance for the given HQL query string and given query result type.- If the query has a single item in the
selectlist, then the select item must be assignable to the given result type. - Otherwise, if there are multiple select items, then the
select items will be packaged into an instance of the
result type. The result type must have an appropriate
constructor with parameter types matching the select items,
or it must be one of the types
Object[],List,Map, orTuple.
If a query has no explicit
selectlist, the select list is inferred from the given query result type:- if the result type is an entity type, the query must have
exactly one root entity in the
fromclause, it must be assignable to the result type, and the inferred select list will contain just that entity, or - otherwise, the select list contains every root entity and
every non-
fetchjoined entity, and each query result will be packaged into an instance of the result type, just as specified above.
The returned
Querymay be executed by callingQuery.getResultList()orQuery.getSingleResult().- Specified by:
createSelectionQueryin interfaceQueryProducer- Parameters:
hqlString- The HQL query as a stringresultType- TheClassobject representing the query result type- See Also:
EntityManager.createQuery(String)
- If the query has a single item in the
-
createSelectionQuery
public <R> SelectionQuery<R> createSelectionQuery(CriteriaQuery<R> criteria)
Description copied from interface:QueryProducerCreate aSelectionQueryreference for the givenCriteriaQuery.- Specified by:
createSelectionQueryin interfaceQueryProducer- See Also:
EntityManager.createQuery(CriteriaQuery)
-
createQuery
public <T> QueryImplementor<T> createQuery(String queryString, Class<T> resultType)
Description copied from interface:QueryProducerCreate a typedQueryinstance for the given HQL query string and given query result type.- If the query has a single item in the
selectlist, then the select item must be assignable to the given result type. - Otherwise, if there are multiple select items, then the
select items will be packaged into an instance of the
result type. The result type must have an appropriate
constructor with parameter types matching the select items,
or it must be one of the types
Object[],List,Map, orTuple.
If a query has no explicit
selectlist, the select list is inferred from the given query result type:- if the result type is an entity type, the query must have
exactly one root entity in the
fromclause, it must be assignable to the result type, and the inferred select list will contain just that entity, or - otherwise, the select list contains every root entity and
every non-
fetchjoined entity, and each query result will be packaged into an instance of the result type, just as specified above.
The returned
Querymay be executed by callingQuery.getResultList()orQuery.getSingleResult().- Specified by:
createQueryin interfaceQueryProducer- Specified by:
createQueryin interfaceQueryProducerImplementor- Parameters:
queryString- The HQL queryresultType- The type of the query result- Returns:
- The
Queryinstance for manipulation and execution - See Also:
EntityManager.createQuery(String,Class)
- If the query has a single item in the
-
createNamedQuery
public QueryImplementor createNamedQuery(String name)
Description copied from interface:QueryProducerCreate a typedQueryinstance for the given named query. The named query might be defined in HQL or in native SQL.- Specified by:
createNamedQueryin interfaceQueryProducer- Specified by:
createNamedQueryin interfaceQueryProducerImplementor- Parameters:
name- the name of a predefined named query- Returns:
- The
Queryinstance for manipulation and execution - See Also:
EntityManager.createNamedQuery(String)
-
createNamedQuery
public <T> QueryImplementor<T> createNamedQuery(String name, Class<T> resultClass)
Description copied from interface:QueryProducerCreate a typedQueryinstance for the given named query. The named query might be defined in HQL or in native SQL.- Specified by:
createNamedQueryin interfaceQueryProducer- Specified by:
createNamedQueryin interfaceQueryProducerImplementor- Parameters:
name- the name of a query defined in metadataresultClass- the type of the query result- Returns:
- The
Queryinstance for manipulation and execution - See Also:
EntityManager.createNamedQuery(String,Class)
-
createNamedSelectionQuery
public SelectionQuery<?> createNamedSelectionQuery(String name)
Description copied from interface:QueryProducerCreate aSelectionQueryinstance for the namedNamedQuery.- Specified by:
createNamedSelectionQueryin interfaceQueryProducer
-
createNamedSelectionQuery
public <R> SelectionQuery<R> createNamedSelectionQuery(String name, Class<R> resultType)
Description copied from interface:QueryProducerCreate aSelectionQueryinstance for the namedNamedQuerywith the given result type.- Specified by:
createNamedSelectionQueryin interfaceQueryProducer
-
createNativeQuery
public NativeQueryImplementor createNativeQuery(String sqlString)
Description copied from interface:QueryProducerCreate aNativeQueryinstance for the given native SQL query.- Specified by:
createNativeQueryin interfaceQueryProducer- Specified by:
createNativeQueryin interfaceQueryProducerImplementor- Parameters:
sqlString- a native SQL query string- Returns:
- The
NativeQueryinstance for manipulation and execution - See Also:
EntityManager.createNativeQuery(String)
-
createNativeQuery
public NativeQueryImplementor createNativeQuery(String sqlString, Class resultClass)
Description copied from interface:QueryProducerCreate aNativeQueryinstance for the given native SQL query using an implicit mapping to the specified Java type.- If the given class is an entity class, this method is equivalent
to
createNativeQuery(sqlString).addEntity(resultClass). - If the given class has a registered
JavaType, then the query must return a result set with a single column whoseJdbcTypeis compatible with thatJavaType. - Otherwise, the select items will be packaged into an instance of
the result type. The result type must have an appropriate
constructor with parameter types matching the select items, or it
must be one of the types
Object[],List,Map, orTuple.
- Specified by:
createNativeQueryin interfaceQueryProducer- Specified by:
createNativeQueryin interfaceQueryProducerImplementor- Parameters:
sqlString- The native (SQL) query stringresultClass- The Java type to map results to- Returns:
- The
NativeQueryinstance for manipulation and execution - See Also:
EntityManager.createNativeQuery(String,Class)
- If the given class is an entity class, this method is equivalent
to
-
createNativeQuery
public <T> NativeQueryImplementor<T> createNativeQuery(String sqlString, Class<T> resultClass, String tableAlias)
Description copied from interface:QueryProducerCreate aNativeQueryinstance for the given native SQL query using an implicit mapping to the specified Java entity type.The given class must be an entity class. This method is equivalent to
createNativeQuery(sqlString).addEntity(tableAlias, resultClass).- Specified by:
createNativeQueryin interfaceQueryProducer- Specified by:
createNativeQueryin interfaceQueryProducerImplementor- Parameters:
sqlString- Native (SQL) query stringresultClass- The Java entity class to map results totableAlias- The table alias for columns in the result set- Returns:
- The
NativeQueryinstance for manipulation and execution - See Also:
EntityManager.createNativeQuery(String,Class)
-
createNativeQuery
public NativeQueryImplementor createNativeQuery(String sqlString, String resultSetMappingName)
Description copied from interface:QueryProducerCreate aNativeQueryinstance for the given native SQL query using an explicit mapping to the specified Java type.The given result set mapping name must identify a mapping defined by a
SqlResultSetMappingannotation.- Specified by:
createNativeQueryin interfaceQueryProducer- Specified by:
createNativeQueryin interfaceQueryProducerImplementor- Parameters:
sqlString- The native (SQL) query stringresultSetMappingName- The explicit result mapping name- Returns:
- The
NativeQueryinstance for manipulation and execution - See Also:
EntityManager.createNativeQuery(String,Class),SqlResultSetMapping
-
createNativeQuery
public <T> NativeQueryImplementor<T> createNativeQuery(String sqlString, String resultSetMappingName, Class<T> resultClass)
Description copied from interface:QueryProducerCreate aNativeQueryinstance for the given native SQL query using an explicit mapping to the specified Java type.The given result set mapping name must identify a mapping defined by a
SqlResultSetMappingannotation.- Specified by:
createNativeQueryin interfaceQueryProducer- Specified by:
createNativeQueryin interfaceQueryProducerImplementor- Parameters:
sqlString- The native (SQL) query stringresultSetMappingName- The explicit result mapping name- Returns:
- The
NativeQueryinstance for manipulation and execution - See Also:
EntityManager.createNativeQuery(String,Class),SqlResultSetMapping
-
createMutationQuery
public MutationQuery createMutationQuery(String statementString)
Description copied from interface:QueryProducerCreate aMutationQueryreference for the given HQL insert, update, or delete statement.- Specified by:
createMutationQueryin interfaceQueryProducer- Specified by:
createMutationQueryin interfaceQueryProducerImplementor
-
createNamedMutationQuery
public MutationQuery createNamedMutationQuery(String name)
Description copied from interface:QueryProducerCreate aMutationQueryinstance for the given named insert, update, or delete HQL query. The named query might be defined as HQL) or native-SQL.- Specified by:
createNamedMutationQueryin interfaceQueryProducer- Specified by:
createNamedMutationQueryin interfaceQueryProducerImplementor
-
createNativeMutationQuery
public MutationQuery createNativeMutationQuery(String sqlString)
Description copied from interface:QueryProducerCreate aNativeQueryinstance for the given native SQL statement.- Specified by:
createNativeMutationQueryin interfaceQueryProducer- Specified by:
createNativeMutationQueryin interfaceQueryProducerImplementor- Parameters:
sqlString- a native SQL statement string- Returns:
- The NativeQuery instance for manipulation and execution
-
createNamedStoredProcedureQuery
public ProcedureCall createNamedStoredProcedureQuery(String name)
Description copied from interface:SharedSessionContractObtain aProcedureCallbased on a named template- Specified by:
createNamedStoredProcedureQueryin interfaceSharedSessionContract- Parameters:
name- The name given to the template- Returns:
- The ProcedureCall
- See Also:
NamedStoredProcedureQuery
-
createStoredProcedureQuery
public ProcedureCall createStoredProcedureQuery(String procedureName)
Description copied from interface:SharedSessionContractCreate aProcedureCallto a stored procedure.- Specified by:
createStoredProcedureQueryin interfaceSharedSessionContract- Parameters:
procedureName- The name of the procedure.- Returns:
- The representation of the procedure call.
-
createStoredProcedureQuery
public ProcedureCall createStoredProcedureQuery(String procedureName, Class<?>... resultClasses)
Description copied from interface:SharedSessionContractCreate aProcedureCallto a stored procedure with the given result set entity mappings. Each given class is considered a "root return".- Specified by:
createStoredProcedureQueryin interfaceSharedSessionContract- Parameters:
procedureName- The name of the procedure.resultClasses- The entity(s) to map the result on to.- Returns:
- The representation of the procedure call.
-
createStoredProcedureQuery
public ProcedureCall createStoredProcedureQuery(String procedureName, String... resultSetMappings)
Description copied from interface:SharedSessionContractCreate aProcedureCallto a stored procedure with the given result set entity mappings.- Specified by:
createStoredProcedureQueryin interfaceSharedSessionContract- Parameters:
procedureName- The name of the procedure.resultSetMappings- The explicit result set mapping(s) to use for mapping the results- Returns:
- The representation of the procedure call.
-
getNamedProcedureCall
public ProcedureCall getNamedProcedureCall(String name)
Description copied from interface:SharedSessionContractObtain aProcedureCallbased on a named template- Specified by:
getNamedProcedureCallin interfaceSharedSessionContract- Parameters:
name- The name given to the template- Returns:
- The ProcedureCall
- See Also:
NamedStoredProcedureQuery
-
createStoredProcedureCall
public ProcedureCall createStoredProcedureCall(String procedureName)
Description copied from interface:SharedSessionContractCreate aProcedureCallto a stored procedure.- Specified by:
createStoredProcedureCallin interfaceSharedSessionContract- Parameters:
procedureName- The name of the procedure.- Returns:
- The representation of the procedure call.
-
createStoredProcedureCall
public ProcedureCall createStoredProcedureCall(String procedureName, Class<?>... resultClasses)
Description copied from interface:SharedSessionContractCreate aProcedureCallto a stored procedure with the given result set entity mappings. Each given class is considered a "root return".- Specified by:
createStoredProcedureCallin interfaceSharedSessionContract- Parameters:
procedureName- The name of the procedure.resultClasses- The entity(s) to map the result on to.- Returns:
- The representation of the procedure call.
-
createStoredProcedureCall
public ProcedureCall createStoredProcedureCall(String procedureName, String... resultSetMappings)
Description copied from interface:SharedSessionContractCreate aProcedureCallto a stored procedure with the given result set entity mappings.- Specified by:
createStoredProcedureCallin interfaceSharedSessionContract- Parameters:
procedureName- The name of the procedure.resultSetMappings- The explicit result set mapping(s) to use for mapping the results- Returns:
- The representation of the procedure call.
-
doWork
public void doWork(Work work) throws HibernateException
Description copied from interface:SharedSessionContractPerform work using theConnectionunderlying by this session.- Specified by:
doWorkin interfaceSharedSessionContract- Parameters:
work- The work to be performed.- Throws:
HibernateException- Generally indicates wrappedSQLException
-
doReturningWork
public <T> T doReturningWork(ReturningWork<T> work) throws HibernateException
Description copied from interface:SharedSessionContractPerform work using theConnectionunderlying by this session, and return a result.- Specified by:
doReturningWorkin interfaceSharedSessionContract- Type Parameters:
T- The type of the result returned from the work- Parameters:
work- The work to be performed.- Returns:
- the result of calling
ReturningWork.execute(java.sql.Connection). - Throws:
HibernateException- Generally indicates wrappedSQLException
-
close
public void close() throws HibernateExceptionDescription copied from interface:SharedSessionContractEnd the session by releasing the JDBC connection and cleaning up.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceSharedSessionContract- Throws:
HibernateException- Indicates problems cleaning up.
-
isOpen
public boolean isOpen()
Description copied from interface:SharedSessionContractCheck if the session is still open.- Specified by:
isOpenin interfaceSharedSessionContract- Returns:
- boolean
-
isConnected
public boolean isConnected()
Description copied from interface:SharedSessionContractCheck if the session is currently connected.- Specified by:
isConnectedin interfaceSharedSessionContract- Returns:
- boolean
-
beginTransaction
public Transaction beginTransaction()
Description copied from interface:SharedSessionContractBegin a unit of work and return the associatedTransactionobject. If a new underlying transaction is required, begin the transaction. Otherwise, continue the new work in the context of the existing underlying transaction.- Specified by:
beginTransactionin interfaceSharedSessionContract- Returns:
- a
Transactioninstance - See Also:
SharedSessionContract.getTransaction()
-
getTransaction
public Transaction getTransaction()
Description copied from interface:SharedSessionContractGet theTransactioninstance associated with this session.- Specified by:
getTransactionin interfaceSharedSessionContract- Returns:
- a Transaction instance
- See Also:
EntityManager.getTransaction()
-
joinTransaction
public void joinTransaction()
Description copied from interface:SharedSessionContractJoin the currently-active JTA transaction.- Specified by:
joinTransactionin interfaceSharedSessionContract- See Also:
EntityManager.joinTransaction()
-
isJoinedToTransaction
public boolean isJoinedToTransaction()
Description copied from interface:SharedSessionContractCheck if the session is joined to the current transaction.- Specified by:
isJoinedToTransactionin interfaceSharedSessionContract- See Also:
SharedSessionContract.joinTransaction(),EntityManager.isJoinedToTransaction()
-
getCriteriaBuilder
public HibernateCriteriaBuilder getCriteriaBuilder()
Description copied from interface:SharedSessionContract- Specified by:
getCriteriaBuilderin interfaceSharedSessionContract- Returns:
- an instance of
HibernateCriteriaBuilder - See Also:
SessionFactory.getCriteriaBuilder()
-
getJdbcBatchSize
public Integer getJdbcBatchSize()
Description copied from interface:SharedSessionContractGet the session-level JDBC batch size for the current session.- Specified by:
getJdbcBatchSizein interfaceJdbcSessionOwner- Specified by:
getJdbcBatchSizein interfaceSharedSessionContract- Returns:
- the current session-level JDBC batch size
- See Also:
SessionFactoryOptions.getJdbcBatchSize(),SessionFactoryBuilder.applyJdbcBatchSize(int)
-
getEventManager
public EventManager getEventManager()
- Specified by:
getEventManagerin interfaceJdbcSessionOwner
-
setJdbcBatchSize
public void setJdbcBatchSize(Integer jdbcBatchSize)
Description copied from interface:SharedSessionContractSet the session-level JDBC batch size. Override the factory-level JDBC batch size controlled by the configuration property "hibernate.jdbc.batch_size".- Specified by:
setJdbcBatchSizein interfaceSharedSessionContract- Parameters:
jdbcBatchSize- the new session-level JDBC batch size- See Also:
BatchSettings.STATEMENT_BATCH_SIZE,SessionFactoryOptions.getJdbcBatchSize(),SessionFactoryBuilder.applyJdbcBatchSize(int)
-
execute
public <T> T execute(LobCreationContext.Callback<T> callback)
Description copied from interface:LobCreationContextExecute the given callback, making sure it has access to a viable JDBCConnection.- Specified by:
executein interfaceLobCreationContext- Type Parameters:
T- The Java type of the type of LOB being created. One ofBlob,Clob,NClob- Parameters:
callback- The callback to execute .- Returns:
- The LOB created by the callback.
-
getFactory
public SessionFactoryImplementor getFactory()
Description copied from interface:SharedSessionContractImplementorObtain the factory which created this session.- Specified by:
getFactoryin interfaceQueryProducerImplementor- Specified by:
getFactoryin interfaceSharedSessionContract- Specified by:
getFactoryin interfaceSharedSessionContractImplementor
-
getEventListenerManager
public SessionEventListenerManager getEventListenerManager()
Description copied from interface:SharedSessionContractImplementorGet theSessionEventListenerManagerassociated with this session.- Specified by:
getEventListenerManagerin interfaceSharedSessionContractImplementor
-
getPersistenceContext
public PersistenceContext getPersistenceContext()
Description copied from interface:SharedSessionContractImplementorGet the persistence context for this session.See
SharedSessionContractImplementor.getPersistenceContextInternal()for a faster alternative.- Specified by:
getPersistenceContextin interfaceSharedSessionContractImplementor
-
getJdbcCoordinator
public JdbcCoordinator getJdbcCoordinator()
Description copied from interface:SharedSessionContractImplementorObtain theJdbcCoordinatorfor this session.- Specified by:
getJdbcCoordinatorin interfaceSharedSessionContractImplementor
-
getJdbcServices
public JdbcServices getJdbcServices()
Description copied from interface:SharedSessionContractImplementorObtain theJdbcServicesfor the factory which created this session.- Specified by:
getJdbcServicesin interfaceSharedSessionContractImplementor
-
getSessionIdentifier
public UUID getSessionIdentifier()
Description copied from interface:SharedSessionContractImplementorObtain aUUIDwhich uniquely identifies this session.The UUID is useful mainly for logging.
- Specified by:
getSessionIdentifierin interfaceSharedSessionContractImplementor
-
isClosed
public boolean isClosed()
Description copied from interface:SharedSessionContractImplementorDetermines whether the session is closed.- Specified by:
isClosedin interfaceSharedSessionContractImplementor- Returns:
trueif the session is closed;falseotherwise.
-
checkOpen
public void checkOpen(boolean markForRollbackIfClosed)
Description copied from interface:SharedSessionContractImplementorCheck whether the session is open, and if not:- if
markForRollbackIfClosed = true, mark the current transaction, if any, for rollback only, and - throw an
IllegalStateException. (JPA specifies this exception type.)
- Specified by:
checkOpenin interfaceSharedSessionContractImplementor
- if
-
prepareForQueryExecution
public void prepareForQueryExecution(boolean requiresTxn)
Description copied from interface:SharedSessionContractImplementorPrepare for the execution of aQueryorProcedureCall- Specified by:
prepareForQueryExecutionin interfaceSharedSessionContractImplementor
-
markForRollbackOnly
public void markForRollbackOnly()
Description copied from interface:SharedSessionContractImplementorMarks current transaction, if any, for rollback only.- Specified by:
markForRollbackOnlyin interfaceSharedSessionContractImplementor
-
getCacheTransactionSynchronization
public CacheTransactionSynchronization getCacheTransactionSynchronization()
Description copied from interface:SharedSessionContractImplementorThe currentCacheTransactionSynchronizationassociated with this session. This may benullif the session is not currently associated with an active transaction.- Specified by:
getCacheTransactionSynchronizationin interfaceSharedSessionContractImplementor
-
isTransactionInProgress
public boolean isTransactionInProgress()
Description copied from interface:SharedSessionContractImplementorDoes this session have an active Hibernate transaction, or is it associated with a JTA transaction currently in progress?- Specified by:
isTransactionInProgressin interfaceSharedSessionContractImplementor
-
accessTransaction
public Transaction accessTransaction()
Description copied from interface:SharedSessionContractImplementorRetrieves the currentTransaction, or creates a new transaction if there is no transaction active.This method is primarily for internal or integrator use.
- Specified by:
accessTransactionin interfaceSharedSessionContractImplementor- Returns:
- the
Transaction
-
generateEntityKey
public EntityKey generateEntityKey(Object id, EntityPersister persister)
Description copied from interface:SharedSessionContractImplementorInstantiate anEntityKeywith the given id and for the entity represented by the givenEntityPersister.- Specified by:
generateEntityKeyin interfaceSharedSessionContractImplementor- Parameters:
id- The entity idpersister- The entity persister- Returns:
- The entity key
-
getInterceptor
public Interceptor getInterceptor()
Description copied from interface:SharedSessionContractImplementorRetrieves theInterceptorassociated with this session.- Specified by:
getInterceptorin interfaceSharedSessionContractImplementor
-
setAutoClear
public void setAutoClear(boolean enabled)
Description copied from interface:SharedSessionContractImplementorEnable or disable automatic cache clearing from after transaction completion.- Specified by:
setAutoClearin interfaceSharedSessionContractImplementor
-
initializeCollection
public void initializeCollection(PersistentCollection<?> collection, boolean writing) throws HibernateException
Description copied from interface:SharedSessionContractImplementorInitialize the given collection (if not already initialized).- Specified by:
initializeCollectionin interfaceSharedSessionContractImplementor- Throws:
HibernateException
-
internalLoad
public Object internalLoad(String entityName, Object id, boolean eager, boolean nullable) throws HibernateException
Description copied from interface:SharedSessionContractImplementorObtain an entity instance with the given id, without checking if it was deleted or scheduled for deletion.- When
nullable = false, this method may create a new proxy or return an existing proxy; if it does not exist, an exception is thrown. - When
nullable = true, the method does not create new proxies, though it might return an existing proxy; if it does not exist, anullvalue is returned.
When
eager = true, the object is eagerly fetched from the database.- Specified by:
internalLoadin interfaceSharedSessionContractImplementor- Throws:
HibernateException
- When
-
immediateLoad
public Object immediateLoad(String entityName, Object id) throws HibernateException
Description copied from interface:SharedSessionContractImplementorLoad an instance immediately. This method is only called when lazily initializing a proxy. Do not return the proxy.- Specified by:
immediateLoadin interfaceSharedSessionContractImplementor- Throws:
HibernateException
-
getEntityPersister
public EntityPersister getEntityPersister(@Nullable String entityName, Object object) throws HibernateException
Description copied from interface:SharedSessionContractImplementorGet theEntityPersisterfor the given entity instance.- Specified by:
getEntityPersisterin interfaceSharedSessionContractImplementor- Parameters:
entityName- optional entity nameobject- the entity instance- Throws:
HibernateException
-
getEntityUsingInterceptor
public Object getEntityUsingInterceptor(EntityKey key) throws HibernateException
Description copied from interface:SharedSessionContractImplementorGet the entity instance associated with the givenEntityKey, calling theInterceptorif necessary.- Specified by:
getEntityUsingInterceptorin interfaceSharedSessionContractImplementor- Throws:
HibernateException
-
getContextEntityIdentifier
public Object getContextEntityIdentifier(Object object)
Description copied from interface:SharedSessionContractImplementorReturn the identifier of the persistent object, or null if it is not associated with this session.- Specified by:
getContextEntityIdentifierin interfaceSharedSessionContractImplementor
-
bestGuessEntityName
public String bestGuessEntityName(Object object)
Description copied from interface:SharedSessionContractImplementorObtain the best estimate of the entity name of the given entity instance, which is not involved in an association, by also considering information held in the proxy, and whether the object is already associated with this session.- Specified by:
bestGuessEntityNamein interfaceSharedSessionContractImplementor
-
guessEntityName
public String guessEntityName(Object entity) throws HibernateException
Description copied from interface:SharedSessionContractImplementorObtain an estimate of the entity name of the given entity instance, which is not involved in an association, using only theEntityNameResolver.- Specified by:
guessEntityNamein interfaceSharedSessionContractImplementor- Throws:
HibernateException
-
instantiate
public Object instantiate(String entityName, Object id) throws HibernateException
Description copied from interface:SharedSessionContractImplementorInstantiate the entity class, initializing with the given identifier.- Specified by:
instantiatein interfaceSharedSessionContractImplementor- Throws:
HibernateException
-
instantiate
public Object instantiate(EntityPersister persister, Object id) throws HibernateException
Description copied from interface:SharedSessionContractImplementorInstantiate the entity class of the givenEntityPersister, initializing the new instance with the given identifier.This is more efficient than
SharedSessionContractImplementor.instantiate(String, Object), but not always interchangeable, since a single persister might be responsible for multiple types.- Specified by:
instantiatein interfaceSharedSessionContractImplementor- Throws:
HibernateException
-
isDefaultReadOnly
public boolean isDefaultReadOnly()
Description copied from interface:SharedSessionContractImplementorAre entities and proxies loaded by this session read-only by default?- Specified by:
isDefaultReadOnlyin interfaceSharedSessionContractImplementor
-
getCacheMode
public CacheMode getCacheMode()
Description copied from interface:SharedSessionContractImplementorGet the currentCacheModefor this session.- Specified by:
getCacheModein interfaceQueryProducerImplementor- Specified by:
getCacheModein interfaceSharedSessionContractImplementor
-
setCacheMode
public void setCacheMode(CacheMode cm)
Description copied from interface:SharedSessionContractImplementorSet the currentCacheModefor this session.- Specified by:
setCacheModein interfaceSharedSessionContractImplementor
-
setCriteriaCopyTreeEnabled
public void setCriteriaCopyTreeEnabled(boolean jpaCriteriaCopyComplianceEnabled)
- Specified by:
setCriteriaCopyTreeEnabledin interfaceSharedSessionContractImplementor
-
isCriteriaCopyTreeEnabled
public boolean isCriteriaCopyTreeEnabled()
- Specified by:
isCriteriaCopyTreeEnabledin interfaceSharedSessionContractImplementor
-
getNativeJdbcParametersIgnored
public boolean getNativeJdbcParametersIgnored()
- Specified by:
getNativeJdbcParametersIgnoredin interfaceSharedSessionContractImplementor
-
setNativeJdbcParametersIgnored
public void setNativeJdbcParametersIgnored(boolean nativeJdbcParametersIgnored)
- Specified by:
setNativeJdbcParametersIgnoredin interfaceSharedSessionContractImplementor
-
getFlushMode
public FlushModeType getFlushMode()
Description copied from interface:SharedSessionContractImplementorGet the currentFlushModeTypefor this session.For users of the Hibernate native APIs, we've had to rename this method as defined by Hibernate historically because the JPA contract defines a method of the same name, but returning the JPA
FlushModeTyperather than Hibernate'sFlushMode. For the former behavior, useSharedSessionContractImplementor.getHibernateFlushMode()instead.- Specified by:
getFlushModein interfaceSharedSessionContractImplementor- Returns:
- The
FlushModeTypein effect for this Session.
-
setHibernateFlushMode
public void setHibernateFlushMode(FlushMode flushMode)
Description copied from interface:SharedSessionContractImplementorSet the currentFlushModefor this session.The flush mode determines the points at which the session is flushed. Flushing is the process of synchronizing the underlying persistent store with persistable state held in memory.
For a logically "read-only" session, it's reasonable to set the session flush mode to
FlushMode.MANUALat the start of the session (in order skip some work and gain some extra performance).- Specified by:
setHibernateFlushModein interfaceSharedSessionContractImplementor- Parameters:
flushMode- the new flush mode
-
getHibernateFlushMode
public FlushMode getHibernateFlushMode()
Description copied from interface:SharedSessionContractImplementorGet the currentFlushModefor this session.- Specified by:
getHibernateFlushModein interfaceQueryProducerImplementor- Specified by:
getHibernateFlushModein interfaceSharedSessionContractImplementor- Returns:
- The flush mode
-
flush
public void flush()
Description copied from interface:SharedSessionContractImplementorFlush this session.- Specified by:
flushin interfaceSharedSessionContractImplementor
-
afterScrollOperation
public void afterScrollOperation()
Description copied from interface:SharedSessionContractImplementorCalled after each operation on aScrollableResults, providing an opportunity for a stateless session to clear its temporary persistence context. For a stateful session, this method does nothing.- Specified by:
afterScrollOperationin interfaceSharedSessionContractImplementor
-
shouldAutoClose
public boolean shouldAutoClose()
Description copied from interface:SharedSessionContractImplementorShould this session be automatically closed after the current transaction completes?- Specified by:
shouldAutoClosein interfaceSharedSessionContractImplementor
-
isAutoCloseSessionEnabled
public boolean isAutoCloseSessionEnabled()
Description copied from interface:SharedSessionContractImplementorIs auto-close at transaction completion enabled?- Specified by:
isAutoCloseSessionEnabledin interfaceSharedSessionContractImplementor- See Also:
TransactionSettings.AUTO_CLOSE_SESSION,SessionFactoryOptions.isAutoCloseSessionEnabled()
-
getLoadQueryInfluencers
public LoadQueryInfluencers getLoadQueryInfluencers()
Description copied from interface:SharedSessionContractImplementorGet theLoadQueryInfluencersassociated with this session.- Specified by:
getLoadQueryInfluencersin interfaceSharedSessionContractImplementor- Returns:
- the
LoadQueryInfluencersassociated with this session; should never be null.
-
getExceptionConverter
public ExceptionConverter getExceptionConverter()
Description copied from interface:SharedSessionContractImplementorObtain anExceptionConverterfor reporting an error.The converter associated to a session might be lazily initialized, so only invoke this getter when there's an actual need to use it.
- Specified by:
getExceptionConverterin interfaceSharedSessionContractImplementor- Returns:
- the ExceptionConverter for this Session.
-
getPersistenceContextInternal
public PersistenceContext getPersistenceContextInternal()
Description copied from interface:SharedSessionContractImplementorSimilar toSharedSessionContractImplementor.getPersistenceContext(), with two differences:- this version performs better as it allows for inlining and probably better prediction, and
- it skips some checks of the current state of the session.
- Specified by:
getPersistenceContextInternalin interfaceSharedSessionContractImplementor- Returns:
- the
PersistenceContextassociated to this session.
-
autoFlushIfRequired
public boolean autoFlushIfRequired(Set<String> querySpaces) throws HibernateException
Description copied from interface:SharedSessionContractImplementordetect in-memory changes, determine if the changes are to tables named in the query and, if so, complete execution the flush- Specified by:
autoFlushIfRequiredin interfaceSharedSessionContractImplementor- Parameters:
querySpaces- the tables named in the query.- Returns:
- true if flush is required, false otherwise.
- Throws:
HibernateException
-
autoFlushIfRequired
public boolean autoFlushIfRequired(Set<String> querySpaces, boolean skipPreFlush) throws HibernateException
- Specified by:
autoFlushIfRequiredin interfaceSharedSessionContractImplementor- Throws:
HibernateException
-
autoPreFlush
public void autoPreFlush()
- Specified by:
autoPreFlushin interfaceSharedSessionContractImplementor
-
afterOperation
public void afterOperation(boolean success)
Description copied from interface:SharedSessionContractImplementorCheck if there is a Hibernate or JTA transaction in progress and, if there is not, flush if necessary, making sure that the connection has been committed (if it is not in autocommit mode), and finally run the after completion processing.- Specified by:
afterOperationin interfaceSharedSessionContractImplementor- Parameters:
success-trueif the operation a success
-
getJdbcSessionContext
public JdbcSessionContext getJdbcSessionContext()
- Specified by:
getJdbcSessionContextin interfaceJdbcSessionOwner
-
getJdbcConnectionAccess
public JdbcConnectionAccess getJdbcConnectionAccess()
- Specified by:
getJdbcConnectionAccessin interfaceJdbcSessionOwner
-
getTransactionCoordinator
public TransactionCoordinator getTransactionCoordinator()
Description copied from interface:JdbcSessionOwnerObtain the builder for TransactionCoordinator instances- Specified by:
getTransactionCoordinatorin interfaceJdbcSessionOwner- Returns:
- The TransactionCoordinatorBuilder
-
startTransactionBoundary
public void startTransactionBoundary()
Description copied from interface:JdbcSessionOwnerCallback indicating recognition of entering into a transactional context whether that is explicitly via the HibernateTransactionAPI or via registration of Hibernate's JTA Synchronization impl with a JTA Transaction- Specified by:
startTransactionBoundaryin interfaceJdbcSessionOwner
-
afterTransactionBegin
public void afterTransactionBegin()
Description copied from interface:JdbcSessionOwnerA after-begin callback from the coordinator to its owner.- Specified by:
afterTransactionBeginin interfaceJdbcSessionOwner
-
beforeTransactionCompletion
public void beforeTransactionCompletion()
Description copied from interface:JdbcSessionOwnerA before-completion callback to the owner.- Specified by:
beforeTransactionCompletionin interfaceJdbcSessionOwner
-
afterTransactionCompletion
public void afterTransactionCompletion(boolean successful, boolean delayed)Description copied from interface:JdbcSessionOwnerAn after-completion callback to the owner.- Specified by:
afterTransactionCompletionin interfaceJdbcSessionOwner- Parameters:
successful- Was the transaction successful?delayed- Is this a delayed after transaction completion call (aka after a timeout)?
-
flushBeforeTransactionCompletion
public void flushBeforeTransactionCompletion()
- Specified by:
flushBeforeTransactionCompletionin interfaceJdbcSessionOwner
-
shouldAutoJoinTransaction
public boolean shouldAutoJoinTransaction()
Description copied from interface:TransactionCoordinatorBuilder.OptionsIndicates whether an active transaction should be automatically joined. Only relevant for JTA-based TransactionCoordinator instances.- Specified by:
shouldAutoJoinTransactionin interfaceTransactionCoordinatorBuilder.Options- Returns:
trueindicates the active transaction should be auto joined;falseindicates it should not (untilTransactionCoordinator.explicitJoin()is called).
-
useStreamForLobBinding
public boolean useStreamForLobBinding()
Description copied from interface:WrapperOptionsDetermines whether streams should be used for binding LOB values.- Specified by:
useStreamForLobBindingin interfaceWrapperOptions- Returns:
true/false- See Also:
Dialect.useInputStreamToInsertBlob()
-
getPreferredSqlTypeCodeForBoolean
public int getPreferredSqlTypeCodeForBoolean()
Description copied from interface:WrapperOptionsThe JDBCtype codeused to bind a null boolean value.- Specified by:
getPreferredSqlTypeCodeForBooleanin interfaceWrapperOptions- See Also:
MappingSettings.PREFERRED_BOOLEAN_JDBC_TYPE,Dialect.getPreferredSqlTypeCodeForBoolean()
-
getLobCreator
public LobCreator getLobCreator()
Description copied from interface:WrapperOptionsObtain access to theLobCreator.- Specified by:
getLobCreatorin interfaceWrapperOptions- Returns:
- The LOB creator
- See Also:
JdbcSettings.NON_CONTEXTUAL_LOB_CREATION,Dialect.getDefaultNonContextualLobCreation()
-
getJdbcTimeZone
public TimeZone getJdbcTimeZone()
Description copied from interface:WrapperOptionsThe JDBCTimeZoneused when writing a value of typeTimeorTimestampto a JDBCPreparedStatement, or when reading from a JDBCResultSet.- When
getJdbcTimeZone()is null, the methodPreparedStatement.setTimestamp(int, java.sql.Timestamp)is called to write a timestamp, andResultSet.getTimestamp(int)is called to read a timestamp. - But when not null, the method
PreparedStatement.setTimestamp(int, java.sql.Timestamp, java.util.Calendar)is called to write a timestamp, andResultSet.getTimestamp(int, java.util.Calendar)is called to read a timestamp.
Thus, the storage
TimeZonecan differ from the default JVM TimeZone given byTimeZone.getDefault().- Specified by:
getJdbcTimeZonein interfaceWrapperOptions- Returns:
- the JDBC
TimeZone, or null if no JDBC timezone was explicitly set - See Also:
JdbcSettings.JDBC_TIME_ZONE
- When
-
createEntityGraph
public <T> RootGraph<T> createEntityGraph(Class<T> rootType)
Description copied from interface:SharedSessionContractCreate a new mutableEntityGraphwith only a root node.- Specified by:
createEntityGraphin interfaceSharedSessionContract- Parameters:
rootType- the root entity class of the graph
-
createEntityGraph
public RootGraph<?> createEntityGraph(String graphName)
Description copied from interface:SharedSessionContractCreate a new mutable copy of the namedEntityGraph, or returnnullif there is no graph with the given name.- Specified by:
createEntityGraphin interfaceSharedSessionContract- Parameters:
graphName- the name of the graph- See Also:
EntityManagerFactory.addNamedEntityGraph(String, EntityGraph)
-
createEntityGraph
public <T> RootGraph<T> createEntityGraph(Class<T> rootType, String graphName)
Description copied from interface:SharedSessionContractCreate a new mutable copy of the namedEntityGraph, or returnnullif there is no graph with the given name.- Specified by:
createEntityGraphin interfaceSharedSessionContract- Parameters:
rootType- the root entity class of the graphgraphName- the name of the graph- See Also:
EntityManagerFactory.addNamedEntityGraph(String, EntityGraph)
-
getEntityGraph
public RootGraph<?> getEntityGraph(String graphName)
Description copied from interface:SharedSessionContractRetrieve the namedEntityGraphas an immutable graph, or returnnullif there is no graph with the given name.- Specified by:
getEntityGraphin interfaceSharedSessionContract- Parameters:
graphName- the name of the graph- See Also:
EntityManagerFactory.addNamedEntityGraph(String, EntityGraph)
-
getEntityGraphs
public <T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> entityClass)
Description copied from interface:SharedSessionContractRetrieve all namedEntityGraphs with the given type.- Specified by:
getEntityGraphsin interfaceSharedSessionContract- See Also:
EntityManagerFactory.addNamedEntityGraph(String, EntityGraph)
-
enableFilter
public Filter enableFilter(String filterName)
Description copied from interface:SharedSessionContractEnable the named filter for this current session.The returned
Filterobject must be used to bind arguments to parameters of the filter, and every parameter must be set before any other operation of this session is called.- Specified by:
enableFilterin interfaceSharedSessionContract- Parameters:
filterName- the name of the filter to be enabled.- Returns:
- the
Filterinstance representing the enabled filter. - See Also:
FilterDef
-
getEnabledFilter
public Filter getEnabledFilter(String filterName)
Description copied from interface:SharedSessionContractRetrieve a currently enabled filter by name.- Specified by:
getEnabledFilterin interfaceSharedSessionContract- Parameters:
filterName- the name of the filter to be retrieved.- Returns:
- the
Filterinstance representing the enabled filter.
-
disableFilter
public void disableFilter(String filterName)
Description copied from interface:SharedSessionContractDisable the named filter for the current session.- Specified by:
disableFilterin interfaceSharedSessionContract- Parameters:
filterName- the name of the filter to be disabled.
-
-