Class SharedSessionDelegatorBaseImpl
- All Implemented Interfaces:
Serializable,AutoCloseable,LobCreationContext,SharedSessionContractImplementor,QueryProducer,QueryProducerImplementor,JdbcSessionOwner,TransactionCoordinatorBuilder.Options,SharedSessionContract,JavaType.CoercionContext,WrapperOptions
SharedSessionContractImplementor. This is useful for custom implementations
of that API, so that only some methods need to be overridden- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.hibernate.engine.jdbc.LobCreationContext
LobCreationContext.Callback<T> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the currentTransaction, or creates a new transaction if there is no transaction active.voidafterObtainConnection(Connection connection) Called after a managed JDBC connection is obtained.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.voidCalled after each operation on aScrollableResults, providing an opportunity for a stateless session to clear its temporary persistence context.voidAn 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) detect in-memory changes, determine if the changes are to tables named in the query and, if so, complete execution the flushvoidvoidbeforeReleaseConnection(Connection connection) Called right before a managed JDBC connection is released.voidA before-completion callback to the owner.Begin a unit of work and return the associatedTransactionobject.bestGuessEntityName(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> RootGraphImplementor<T> createEntityGraph(Class<T> rootType) Create a new mutable instance ofEntityGraph, with only a root node, allowing programmatic definition of the graph from scratch.<T> RootGraph<T> createEntityGraph(Class<T> rootType, String graphName) Create a new mutable instance ofEntityGraph, based on a predefined named entity graph, allowing customization of the graph, or returnnullif there is no predefined graph with the given name.createEntityGraph(String graphName) Create a new mutable instance ofEntityGraph, based on a predefined named entity graph, allowing customization of the graph, or returnnullif there is no predefined graph with the given name.createMutationQuery(CriteriaDelete deleteQuery) Create aMutationQueryfrom the given delete criteria treecreateMutationQuery(CriteriaUpdate updateQuery) Create aMutationQueryfrom the given update criteria treecreateMutationQuery(String statementString) Create aMutationQueryreference for the given HQL insert, update, or delete statement.createMutationQuery(JpaCriteriaInsert insert) Create aMutationQueryfrom the given insert criteria treeCreate aMutationQueryinstance for the given named insert, update, or delete HQL query.createNamedQuery(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.Create aSelectionQueryinstance for the namedNamedQuery.<R> SelectionQuery<R> createNamedSelectionQuery(String name, Class<R> resultType) Create aSelectionQueryinstance for the namedNamedQuerywith the given result type.Obtain aProcedureCallbased on a named templatecreateNativeMutationQuery(String sqlString) Create aNativeQueryinstance for the given native SQL statement.createNativeQuery(String sqlString) Create aNativeQueryinstance for the given native SQL query.createNativeQuery(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.createNativeQuery(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.createQuery(CriteriaDelete deleteQuery) Create aMutationQueryfor the given JPACriteriaDelete<T> QueryImplementor<T> createQuery(CriteriaQuery<T> criteriaQuery) Create aQueryfor the given JPACriteriaQuery.createQuery(CriteriaUpdate updateQuery) Create aMutationQueryfor the given JPACriteriaUpdate<R> QueryImplementor<R> createQuery(TypedQueryReference<R> typedQueryReference) Create a typedQueryinstance for the given typed query reference.createQuery(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.createSelectionQuery(String hqlString) Create aSelectionQueryreference for the given HQLselectstatement.<R> SelectionQuery<R> createSelectionQuery(String hqlString, EntityGraph<R> resultGraph) Create aSelectionQueryinstance for the given HQL query string and givenEntityGraph, which is interpreted as a load graph.<R> SelectionQuery<R> createSelectionQuery(String hqlString, Class<R> resultType) Create aSelectionQueryinstance for the given HQL query string and given query result type.createStoredProcedureCall(String procedureName) Create aProcedureCallto a stored procedure.createStoredProcedureCall(String procedureName, Class<?>... resultClasses) Create aProcedureCallto a stored procedure with the given result set entity mappings.createStoredProcedureCall(String procedureName, String... resultSetMappings) Create aProcedureCallto a stored procedure with the given result set entity mappings.createStoredProcedureQuery(String procedureName) Create aProcedureCallto a stored procedure.createStoredProcedureQuery(String procedureName, Class<?>... resultClasses) Create aProcedureCallto a stored procedure with the given result set entity mappings.createStoredProcedureQuery(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.voidPerform work using theConnectionunderlying by this session.enableFilter(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.voidgenerateEntityKey(Object id, EntityPersister persister) Instantiate anEntityKeywith the given id and for the entity represented by the givenEntityPersister.Get the current cache mode for this session.The currentCacheTransactionSynchronizationassociated with this session.getContextEntityIdentifier(Object object) Return the identifier of the persistent object, or null if it is not associated with this session.getEnabledFilter(String filterName) Retrieve a currently enabled filter by name.getEntityGraph(String graphName) Obtain an immutable reference to a predefined named entity graph.<T> List<EntityGraph<? super T>> getEntityGraphs(Class<T> entityClass) Retrieve all namedEntityGraphs with the given root entity type.getEntityPersister(@Nullable String entityName, Object object) Get theEntityPersisterfor the given entity instance.Get the entity instance associated with the givenEntityKey, calling theInterceptorif necessary.Get theSessionEventListenerManagerassociated with this session.Obtain a reference to theEventMonitor.Obtain anExceptionConverterfor reporting an error.Obtain the factory which created this session.Get the currentFlushModefor this session.Retrieves theInterceptorassociated with this session.Get the session-level JDBC batch size for the current session.Obtain theJdbcCoordinatorfor this session.Obtain theJdbcServicesfor the factory which created this session.The JDBCTimeZoneused when writing a value of typeTimeorTimestampto a JDBCPreparedStatement, or when reading from a JDBCResultSet.Obtain the JSONFormatMapper.Get theLoadQueryInfluencersassociated with this session.Obtain access to theLobCreator.getNamedNativeQuery(String name) Get aNativeQueryinstance for a named native SQL querygetNamedNativeQuery(String name, String resultSetMapping) Get aNativeQueryinstance for a named native SQL querygetNamedProcedureCall(String name) Obtain aProcedureCallbased on a named templategetNamedQuery(String name) Create aQueryinstance for the named query.booleanGet the persistence context for this session.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.intThe JDBCtype codeused to bind a null boolean value.Wrap all state that lazy loading interceptors might need to manage association with this session, or to handle lazy loading after detachment via the UUID of the SessionFactory.Obtain aUUIDwhich uniquely identifies this session.Obtain the tenant identifier associated with this session, as a string.Obtain the tenant identifier associated with this session.Get theTransactioninstance associated with this session.Obtain theTransactionCoordinator.Obtain the XMLFormatMapper.guessEntityName(Object entity) Obtain an estimate of the entity name of the given entity instance, which is not involved in an association, using only theEntityNameResolver.immediateLoad(String entityName, Object id) Load an instance immediately.voidinitializeCollection(PersistentCollection<?> collection, boolean writing) Initialize the given collection (if not already initialized).instantiate(String entityName, Object id) Deprecated.instantiate(EntityPersister persister, Object id) Instantiate the entity class of the givenEntityPersister, initializing the new instance with the given identifier.internalLoad(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.booleanisClosed()Determines whether the session is closed.booleanCheck if the session is currently connected.booleanbooleanbooleanAre entities and proxies loaded by this session read-only by default?booleanbooleanCheck if the session is joined to the current transaction.booleanisOpen()Check if the session is still open.booleanDoes this session have an active Hibernate transaction, or is it associated with a JTA transaction currently in progress?voidJoin the currently-active JTA transaction.loadFromSecondLevelCache(EntityPersister persister, EntityKey entityKey, Object instanceToLoad, LockMode lockMode) Attempts to load the entity from the second-level cache.voidlock(String entityName, Object child, LockOptions lockOptions) Cascade the lock operation to the given child entity.voidMarks current transaction, if any, for rollback only.voidprepareForQueryExecution(boolean requiresTxn) Prepare for the execution of aQueryorProcedureCallvoidRegisters the given process for execution after transaction completion.voidsetCacheMode(CacheMode cacheMode) Set the current cache mode for this session.voidsetCriteriaCopyTreeEnabled(boolean jpaCriteriaCopyComplianceEnabled) voidsetCriteriaPlanCacheEnabled(boolean jpaCriteriaCacheEnabled) voidsetJdbcBatchSize(Integer jdbcBatchSize) Set the session-level JDBC batch size.voidsetNativeJdbcParametersIgnored(boolean nativeJdbcParametersIgnored) booleanIndicates whether an active transaction should be automatically joined.voidCallback 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 TransactionbooleanDetermines 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, waitMethods inherited from interface org.hibernate.resource.jdbc.spi.JdbcSessionOwner
getEventManager, getSqlExceptionHelperMethods inherited from interface org.hibernate.engine.jdbc.LobCreationContext
fromContextMethods inherited from interface org.hibernate.SharedSessionContract
fromTransaction, inTransaction, unwrapMethods inherited from interface org.hibernate.engine.spi.SharedSessionContractImplementor
asEventSource, asSessionImplementor, asStatelessSession, bestGuessEntityName, checkOpen, checkTransactionNeededForUpdateOperation, getConfiguredJdbcBatchSize, getDialect, getSession, getSessionFactory, getSessionToken, getTypeConfiguration, isEventSource, isOpenOrWaitingForAutoClose, isSessionImplementor, isStatelessSession
-
Field Details
-
delegate
-
-
Constructor Details
-
SharedSessionDelegatorBaseImpl
-
-
Method Details
-
delegate
Returns the delegate session. -
getTenantIdentifier
Description copied from interface:SharedSessionContractObtain the tenant identifier associated with this session, as a string.- Specified by:
getTenantIdentifierin interfaceSharedSessionContract- Returns:
- The tenant identifier associated with this session, or
null - See Also:
-
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 - See Also:
-
createMutationQuery
Description copied from interface:QueryProducerCreate aMutationQueryfrom the given update criteria tree- Specified by:
createMutationQueryin interfaceQueryProducer- Specified by:
createMutationQueryin interfaceQueryProducerImplementor
-
createMutationQuery
Description copied from interface:QueryProducerCreate aMutationQueryfrom the given delete criteria tree- Specified by:
createMutationQueryin interfaceQueryProducer- Specified by:
createMutationQueryin interfaceQueryProducerImplementor
-
createMutationQuery
Description copied from interface:QueryProducerCreate aMutationQueryfrom the given insert criteria tree- Specified by:
createMutationQueryin interfaceQueryProducer
-
createQuery
Description copied from interface:QueryProducerCreate aQueryfor the given JPACriteriaQuery.- Specified by:
createQueryin interfaceQueryProducer- Specified by:
createQueryin interfaceQueryProducerImplementor
-
createQuery
Description copied from interface:QueryProducerCreate aMutationQueryfor the given JPACriteriaUpdate- Specified by:
createQueryin interfaceQueryProducer- Specified by:
createQueryin interfaceQueryProducerImplementor
-
createQuery
Description copied from interface:QueryProducerCreate aMutationQueryfor the given JPACriteriaDelete- Specified by:
createQueryin interfaceQueryProducer- Specified by:
createQueryin interfaceQueryProducerImplementor
-
getNamedQuery
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
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
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
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, and it has no non-fetchjoins, then that root entity is the only element of the select list, or - if there is an entity with the alias
this, then that entity is the only element of the select list, or - otherwise, the query is considered ambiguous, and this
method throws a
SemanticException.
The query must have an explicit
fromclause, which can never be inferred.- Specified by:
createQueryin interfaceQueryProducer- Specified by:
createQueryin interfaceQueryProducerImplementor- Parameters:
queryString- The HQL query- Returns:
- The
Queryinstance for manipulation and execution - See Also:
- if there is exactly one root entity in the
-
createSelectionQuery
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, and it has no non-fetchjoins, then that root entity is the only element of the select list, or - if there is an entity with the alias
this, then that entity is the only element of the select list, or - otherwise, the query is considered ambiguous, and this
method throws a
SemanticException.
The query must have an explicit
fromclause, which can never be inferred.- Specified by:
createSelectionQueryin interfaceQueryProducer
- if there is exactly one root entity in the
-
createSelectionQuery
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.
If a query has no explicit
fromclause, and the given result type is an entity type, the root entity is inferred to be the result type.Passing
Object.classas the query result type is not recommended. In this special case, this method has the same semantics as the overloadQueryProducer.createSelectionQuery(String).The returned
Querymay be executed by callingQuery.getResultList()orQuery.getSingleResult().- Specified by:
createSelectionQueryin interfaceQueryProducer- Parameters:
hqlString- The HQLselectquery as a stringresultType- TheClassobject representing the query result type, which should not beObject.class- See Also:
- If the query has a single item in the
-
createSelectionQuery
Description copied from interface:QueryProducerCreate aSelectionQueryinstance for the given HQL query string and givenEntityGraph, which is interpreted as a load graph. The query result type is the root entity of the given graph.- If the query has an explicit
selectclause, there must be a single item in theselectlist, and the select item must be assignable to the root type of the given graph. - Otherwise, if a query has no explicit
selectlist, the select list is inferred from the given entity graph. The query must have exactly one root entity in thefromclause, it must be assignable to the root type of the given graph, and the inferred select list will contain just that entity.
If a query has no explicit
fromclause, and the given result type is an entity type, the root entity is inferred to be the result type.The returned
Querymay be executed by callingQuery.getResultList()orQuery.getSingleResult().- Specified by:
createSelectionQueryin interfaceQueryProducer- Parameters:
hqlString- The HQLselectquery as a stringresultGraph- AnEntityGraphwhose root type is the query result type, which is interpreted as a load graph- See Also:
- If the query has an explicit
-
createSelectionQuery
Description copied from interface:QueryProducerCreate aSelectionQueryreference for the givenCriteriaQuery.- Specified by:
createSelectionQueryin interfaceQueryProducer- See Also:
-
createQuery
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.
If a query has no explicit
fromclause, and the given result type is an entity type, the root entity is inferred to be the result type.Passing
Object.classas the query result type is not recommended. In this special case, this method has the same semantics as the overloadQueryProducer.createQuery(String).The returned
Querymay be executed by callingQuery.getResultList()orQuery.getSingleResult().- Specified by:
createQueryin interfaceQueryProducer- Specified by:
createQueryin interfaceQueryProducerImplementor- Parameters:
queryString- The HQL queryresultType- TheClassobject representing the query result type, which should not beObject.class- Returns:
- The
Queryinstance for manipulation and execution - See Also:
- If the query has a single item in the
-
createQuery
Description copied from interface:QueryProducerCreate a typedQueryinstance for the given typed query reference.- Specified by:
createQueryin interfaceQueryProducer- Specified by:
createQueryin interfaceQueryProducerImplementor- Parameters:
typedQueryReference- the type query reference- Returns:
- The
Queryinstance for execution - See Also:
-
createNamedQuery
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:
-
createNamedQuery
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:
-
createNamedSelectionQuery
Description copied from interface:QueryProducerCreate aSelectionQueryinstance for the namedNamedQuery.- Specified by:
createNamedSelectionQueryin interfaceQueryProducer
-
createNamedSelectionQuery
Description copied from interface:QueryProducerCreate aSelectionQueryinstance for the namedNamedQuerywith the given result type.- Specified by:
createNamedSelectionQueryin interfaceQueryProducer
-
createNativeQuery
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:
-
createNativeQuery
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:
- 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:
-
createNativeQuery
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:
-
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:
-
createMutationQuery
Description copied from interface:QueryProducerCreate aMutationQueryreference for the given HQL insert, update, or delete statement.- Specified by:
createMutationQueryin interfaceQueryProducer- Specified by:
createMutationQueryin interfaceQueryProducerImplementor- Parameters:
statementString- The HQLinsert,update, ordeletestatement
-
createNamedMutationQuery
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
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
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:
-
createStoredProcedureQuery
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
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
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
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:
-
createStoredProcedureCall
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
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
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
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
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
Description copied from interface:SharedSessionContractEnd the session by releasing the JDBC connection and cleaning up.- Specified by:
closein interfaceAutoCloseable- 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:
trueif it is open
-
isConnected
public boolean isConnected()Description copied from interface:SharedSessionContractCheck if the session is currently connected.- Specified by:
isConnectedin interfaceSharedSessionContract- Returns:
trueif it is connected
-
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:
- an instance of
Transactionrepresenting the new transaction - See Also:
-
getTransaction
Description copied from interface:SharedSessionContractGet theTransactioninstance associated with this session.- Specified by:
getTransactionin interfaceSharedSessionContract- Returns:
- an instance of
Transactionrepresenting the transaction associated with this session - See Also:
-
joinTransaction
public void joinTransaction()Description copied from interface:SharedSessionContractJoin the currently-active JTA transaction.- Specified by:
joinTransactionin interfaceSharedSessionContract- See Also:
-
isJoinedToTransaction
public boolean isJoinedToTransaction()Description copied from interface:SharedSessionContractCheck if the session is joined to the current transaction.- Specified by:
isJoinedToTransactionin interfaceSharedSessionContract- See Also:
-
getCriteriaBuilder
Description copied from interface:SharedSessionContract- Specified by:
getCriteriaBuilderin interfaceSharedSessionContract- Returns:
- an instance of
HibernateCriteriaBuilder - See Also:
-
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:
-
getEventMonitor
Description copied from interface:JdbcSessionOwnerObtain a reference to theEventMonitor.- Specified by:
getEventMonitorin interfaceJdbcSessionOwner
-
setJdbcBatchSize
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:
-
execute
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
Description copied from interface:SharedSessionContractImplementorObtain the factory which created this session.- Specified by:
getFactoryin interfaceQueryProducerImplementor- Specified by:
getFactoryin interfaceSharedSessionContract- Specified by:
getFactoryin interfaceSharedSessionContractImplementor
-
getEventListenerManager
Description copied from interface:SharedSessionContractImplementorGet theSessionEventListenerManagerassociated with this session.- Specified by:
getEventListenerManagerin interfaceSharedSessionContractImplementor
-
getPersistenceContext
Description copied from interface:SharedSessionContractImplementorGet the persistence context for this session.See
SharedSessionContractImplementor.getPersistenceContextInternal()for a faster alternative.- Specified by:
getPersistenceContextin interfaceSharedSessionContractImplementor
-
getJdbcCoordinator
Description copied from interface:SharedSessionContractImplementorObtain theJdbcCoordinatorfor this session.- Specified by:
getJdbcCoordinatorin interfaceSharedSessionContractImplementor
-
getJdbcServices
Description copied from interface:SharedSessionContractImplementorObtain theJdbcServicesfor the factory which created this session.- Specified by:
getJdbcServicesin interfaceSharedSessionContractImplementor
-
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
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
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
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
Description copied from interface:SharedSessionContractImplementorRetrieves theInterceptorassociated with this session.- Specified by:
getInterceptorin 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
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
Description copied from interface:SharedSessionContractImplementorGet the entity instance associated with the givenEntityKey, calling theInterceptorif necessary.- Specified by:
getEntityUsingInterceptorin interfaceSharedSessionContractImplementor- Throws:
HibernateException
-
getContextEntityIdentifier
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
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
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
Deprecated.Description copied from interface:SharedSessionContractImplementorInstantiate the entity class, initializing with the given identifier.- Specified by:
instantiatein interfaceSharedSessionContractImplementor- Throws:
HibernateException
-
instantiate
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
Description copied from interface:SharedSessionContractGet the current cache mode for this session.- Specified by:
getCacheModein interfaceQueryProducerImplementor- Specified by:
getCacheModein interfaceSharedSessionContract- Returns:
- the current cache mode
-
setCacheMode
Description copied from interface:SharedSessionContractSet the current cache mode for this session.The cache mode determines the manner in which this session can interact with the second level cache.
- Specified by:
setCacheModein interfaceSharedSessionContract- Parameters:
cacheMode- the new cache mode
-
setCriteriaCopyTreeEnabled
public void setCriteriaCopyTreeEnabled(boolean jpaCriteriaCopyComplianceEnabled) - Specified by:
setCriteriaCopyTreeEnabledin interfaceSharedSessionContractImplementor
-
isCriteriaCopyTreeEnabled
public boolean isCriteriaCopyTreeEnabled()- Specified by:
isCriteriaCopyTreeEnabledin interfaceSharedSessionContractImplementor
-
isCriteriaPlanCacheEnabled
public boolean isCriteriaPlanCacheEnabled()- Specified by:
isCriteriaPlanCacheEnabledin interfaceSharedSessionContractImplementor
-
setCriteriaPlanCacheEnabled
public void setCriteriaPlanCacheEnabled(boolean jpaCriteriaCacheEnabled) - Specified by:
setCriteriaPlanCacheEnabledin interfaceSharedSessionContractImplementor
-
getNativeJdbcParametersIgnored
public boolean getNativeJdbcParametersIgnored()- Specified by:
getNativeJdbcParametersIgnoredin interfaceSharedSessionContractImplementor
-
setNativeJdbcParametersIgnored
public void setNativeJdbcParametersIgnored(boolean nativeJdbcParametersIgnored) - Specified by:
setNativeJdbcParametersIgnoredin interfaceSharedSessionContractImplementor
-
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
-
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
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
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
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 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.skipPreFlush- seeAutoFlushEvent.isSkipPreFlush()- Returns:
- true if flush is required, false otherwise.
- 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
- Specified by:
getJdbcSessionContextin interfaceJdbcSessionOwner
-
getJdbcConnectionAccess
- Specified by:
getJdbcConnectionAccessin interfaceJdbcSessionOwner
-
getTransactionCoordinator
Description copied from interface:JdbcSessionOwnerObtain theTransactionCoordinator.- Specified by:
getTransactionCoordinatorin interfaceJdbcSessionOwner- Returns:
- The
TransactionCoordinator
-
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:JdbcSessionOwnerAn 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:
-
getPreferredSqlTypeCodeForBoolean
public int getPreferredSqlTypeCodeForBoolean()Description copied from interface:WrapperOptionsThe JDBCtype codeused to bind a null boolean value.- Specified by:
getPreferredSqlTypeCodeForBooleanin interfaceWrapperOptions- See Also:
-
getLobCreator
Description copied from interface:WrapperOptionsObtain access to theLobCreator.- Specified by:
getLobCreatorin interfaceWrapperOptions- Returns:
- The LOB creator
- See Also:
-
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:
- When
-
createEntityGraph
Description copied from interface:SharedSessionContractCreate a new mutable instance ofEntityGraph, with only a root node, allowing programmatic definition of the graph from scratch.- Specified by:
createEntityGraphin interfaceSharedSessionContract- Specified by:
createEntityGraphin interfaceSharedSessionContractImplementor- Parameters:
rootType- the root entity class of the graph- See Also:
-
createEntityGraph
Description copied from interface:SharedSessionContractCreate a new mutable instance ofEntityGraph, based on a predefined named entity graph, allowing customization of the graph, or returnnullif there is no predefined graph with the given name.- Specified by:
createEntityGraphin interfaceSharedSessionContract- Specified by:
createEntityGraphin interfaceSharedSessionContractImplementor- Parameters:
graphName- the name of the graph- See Also:
-
createEntityGraph
Description copied from interface:SharedSessionContractCreate a new mutable instance ofEntityGraph, based on a predefined named entity graph, allowing customization of the graph, or returnnullif there is no predefined graph with the given name.- Specified by:
createEntityGraphin interfaceSharedSessionContract- Parameters:
rootType- the root entity class of the graphgraphName- the name of the predefined named entity graph- See Also:
-
getEntityGraph
Description copied from interface:SharedSessionContractObtain an immutable reference to a predefined named entity graph.- Specified by:
getEntityGraphin interfaceSharedSessionContract- Specified by:
getEntityGraphin interfaceSharedSessionContractImplementor- Parameters:
graphName- the name of the predefined named entity graph- See Also:
-
getEntityGraphs
Description copied from interface:SharedSessionContractRetrieve all namedEntityGraphs with the given root entity type.- Specified by:
getEntityGraphsin interfaceSharedSessionContract- See Also:
-
enableFilter
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:
-
getEnabledFilter
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
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.
-
getJsonFormatMapper
Description copied from interface:WrapperOptionsObtain the JSONFormatMapper.- Specified by:
getJsonFormatMapperin interfaceWrapperOptions
-
getXmlFormatMapper
Description copied from interface:WrapperOptionsObtain the XMLFormatMapper.- Specified by:
getXmlFormatMapperin interfaceWrapperOptions
-
lock
Description copied from interface:SharedSessionContractImplementorCascade the lock operation to the given child entity.- Specified by:
lockin interfaceSharedSessionContractImplementor
-
registerProcess
Description copied from interface:SharedSessionContractImplementorRegisters the given process for execution after transaction completion.- Specified by:
registerProcessin interfaceSharedSessionContractImplementor- Parameters:
process- The process to register
-
loadFromSecondLevelCache
public Object loadFromSecondLevelCache(EntityPersister persister, EntityKey entityKey, Object instanceToLoad, LockMode lockMode) Description copied from interface:SharedSessionContractImplementorAttempts to load the entity from the second-level cache.- Specified by:
loadFromSecondLevelCachein interfaceSharedSessionContractImplementor- Parameters:
persister- The persister for the entity being requested for loadentityKey- The entity keyinstanceToLoad- The instance that is being initialized, or nulllockMode- The lock mode- Returns:
- The entity from the second-level cache, or null.
-
getSessionAssociationMarkers
Description copied from interface:SharedSessionContractImplementorWrap all state that lazy loading interceptors might need to manage association with this session, or to handle lazy loading after detachment via the UUID of the SessionFactory. N.B. this captures the current Session, however it can get updated to a null session (for detached entities) or updated to a different Session.- Specified by:
getSessionAssociationMarkersin interfaceSharedSessionContractImplementor
-
isIdentifierRollbackEnabled
public boolean isIdentifierRollbackEnabled()- Specified by:
isIdentifierRollbackEnabledin interfaceSharedSessionContractImplementor
-
afterObtainConnection
Description copied from interface:JdbcSessionOwnerCalled after a managed JDBC connection is obtained.Sets the schema to the schema belonging to the current tenant if:
- "hibernate.multi_tenant.schema_mapper" is enabled, and
- this session has an active tenant id.
- Specified by:
afterObtainConnectionin interfaceJdbcSessionOwner- Parameters:
connection- A JDBC connection which was just acquired- Throws:
SQLException
-
beforeReleaseConnection
Description copied from interface:JdbcSessionOwnerCalled right before a managed JDBC connection is released.Unset the schema which was set by
JdbcSessionOwner.afterObtainConnection(java.sql.Connection), if any. .- Specified by:
beforeReleaseConnectionin interfaceJdbcSessionOwner- Parameters:
connection- The JDBC connection which is about to be released- Throws:
SQLException
-