Class AbstractSharedSessionContract
- java.lang.Object
-
- org.hibernate.internal.AbstractSharedSessionContract
-
- All Implemented Interfaces:
Closeable,Serializable,AutoCloseable,LobCreationContext,SharedSessionContractImplementor,QueryProducer,QueryProducerImplementor,JdbcSessionOwner,TransactionCoordinatorBuilder.Options,SharedSessionContract,JavaType.CoercionContext,WrapperOptions
- Direct Known Subclasses:
SessionImpl,StatelessSessionImpl
public abstract class AbstractSharedSessionContract extends Object implements SharedSessionContractImplementor
Base class for implementations ofSharedSessionContractandSharedSessionContractImplementor. Intended for concrete implementations ofSessionandStatelessSession.- See Also:
SessionImpl,StatelessSessionImpl, Serialized Form- Implementation Note:
- A
Sessionor JPAEntityManageris a single-threaded object, which may not be called concurrently. Therefore, this implementation defines access to a number of instance state values in a manner that is not exactly thread-safe.
-
-
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 booleanclosedprotected FastSessionServicesfastSessionServicesprotected booleanwaitingForAutoClose
-
Constructor Summary
Constructors Constructor Description AbstractSharedSessionContract(SessionFactoryImpl factory, SessionCreationOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description TransactionaccessTransaction()Retrieves the currentTransaction, or creates a new transaction if there is no transaction active.protected <T> voidaddResultType(Class<T> resultClass, NativeQueryImplementor<T> query)Deprecated, for removal: This API element is subject to removal in a future version.protected voidaddSharedSessionTransactionObserver(TransactionCoordinator transactionCoordinator)voidafterTransactionCompletion(boolean successful, boolean delayed)An after-completion callback to the owner.protected voidapplyQuerySettingsAndHints(Query<?> query)protected voidapplyQuerySettingsAndHints(SelectionQuery<?> query)voidbeforeTransactionCompletion()A before-completion callback to the owner.TransactionbeginTransaction()Begin a unit of work and return the associatedTransactionobject.protected <T> QueryImplementor<T>buildNamedQuery(String queryName, Class<T> resultType)protected <Q> QbuildNamedQuery(String queryName, Function<NamedSqmQueryMemento,Q> sqlCreator, Function<NamedNativeQueryMemento,Q> nativeCreator)protected static voidcheckMutationQuery(String hqlString, SqmStatement<?> sqmStatement)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.protected voidcheckOpenOrWaitingForAutoClose()protected static <R> voidcheckResultType(Class<R> expectedResultType, SqmSelectionQueryImpl<R> query)protected static voidcheckSelectionQuery(String hql, HqlInterpretation<?> hqlInterpretation)voidcheckTransactionNeededForUpdateOperation(String exceptionMessage)Check if an activeTransactionis available before performing an update operation against the database.protected voidcheckTransactionSynchStatus()protected voidcleanupOnClose()voidclose()End the session by releasing the JDBC connection and cleaning up.<T> RootGraphImplementor<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.RootGraphImplementor<?>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 hqlString)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 queryName)Create aMutationQueryinstance for the given named insert, update, or delete HQL query.QueryImplementorcreateNamedQuery(String name)Create a typedQueryinstance for the given named query.<R> QueryImplementor<R>createNamedQuery(String name, Class<R> resultClass)Create a typedQueryinstance for the given named query.SelectionQuery<?>createNamedSelectionQuery(String queryName)Create aSelectionQueryinstance for the namedNamedQuery.<R> SelectionQuery<R>createNamedSelectionQuery(String queryName, Class<R> expectedResultType)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, @Nullable 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.protected <T> NativeQueryImplementor<T>createNativeQueryImplementor(Class<T> resultType, NamedNativeQueryMemento memento)protected NativeQueryImplementor<?>createNativeQueryImplementor(String queryName, NamedNativeQueryMemento memento)QueryImplementorcreateQuery(CriteriaDelete criteriaDelete)Create aMutationQueryfor the given JPACriteriaDelete<T> QueryImplementor<T>createQuery(CriteriaQuery<T> criteriaQuery)Create aQueryfor the given JPACriteriaQuery.QueryImplementorcreateQuery(CriteriaUpdate criteriaUpdate)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> expectedResultType)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> expectedResultType)Create aSelectionQueryinstance for the given HQL query string and given query result type.protected <T> SqmQueryImplementor<T>createSqmQueryImplementor(Class<T> resultType, NamedSqmQueryMemento memento)protected SqmQueryImplementor<?>createSqmQueryImplementor(String queryName, NamedSqmQueryMemento memento)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 voiddelayedAfterCompletion()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.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.IntegergetConfiguredJdbcBatchSize()Override the implementation provided on SharedSessionContractImplementor which is not very efficient: this method is hot in Hibernate Reactive, and could be hot in some ORM contexts as well.HibernateCriteriaBuildergetCriteriaBuilder()protected TransactionImplementorgetCurrentTransaction()FiltergetEnabledFilter(String filterName)Retrieve a currently enabled filter by name.RootGraphImplementor<?>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.EntityNameResolvergetEntityNameResolver()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.LobCreatorgetLobCreator()Obtain access to theLobCreator.NativeQueryImplementorgetNamedNativeQuery(String queryName)Get aNativeQueryinstance for a named native SQL queryNativeQueryImplementorgetNamedNativeQuery(String queryName, String resultSetMapping)Get aNativeQueryinstance for a named native SQL queryProcedureCallgetNamedProcedureCall(String name)Obtain aProcedureCallbased on a named templateQueryImplementorgetNamedQuery(String queryName)Create aQueryinstance for the named query.booleangetNativeJdbcParametersIgnored()intgetPreferredSqlTypeCodeForBoolean()The JDBCtype codeused to bind a null boolean value.protected NamedResultSetMappingMementogetResultSetMappingMemento(String resultSetMappingName)UUIDgetSessionIdentifier()Obtain aUUIDwhich uniquely identifies this session.ObjectgetSessionToken()Obtain a "token" which 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 instancesprotected <R> HqlInterpretation<R>interpretHql(String hql, Class<R> resultType)booleanisClosed()Determines whether the session is closed.booleanisConnected()Check if the session is currently connected.booleanisCriteriaCopyTreeEnabled()booleanisJoinedToTransaction()Check if the session is joined to the current transaction.booleanisOpen()Check if the session is still open.booleanisOpenOrWaitingForAutoClose()Determines whether the session is open or is waiting for auto-close.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.protected abstract Objectload(String entityName, Object identifier)voidmarkForRollbackOnly()Marks current transaction, if any, for rollback only.protected voidprepareForAutoClose()voidprepareForQueryExecution(boolean requiresTxn)Prepare for the execution of aQueryorProcedureCallprotected voidpulseTransactionCoordinator()protected voidremoveSharedSessionTransactionObserver(TransactionCoordinator transactionCoordinator)voidsetCacheMode(CacheMode cacheMode)Set the currentCacheModefor this session.protected voidsetClosed()voidsetCriteriaCopyTreeEnabled(boolean jpaCriteriaCopyComplianceEnabled)voidsetHibernateFlushMode(FlushMode flushMode)Set the currentFlushModefor this session.voidsetJdbcBatchSize(Integer jdbcBatchSize)Set the session-level JDBC batch size.voidsetNativeJdbcParametersIgnored(boolean nativeJdbcParametersIgnored)protected voidsetUpMultitenancy(SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers)booleanshouldAutoJoinTransaction()Indicates whether an active transaction should be automatically joined.protected booleanshouldCloseJdbcCoordinatorOnClose(boolean isTransactionCoordinatorShared)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
afterTransactionBegin, flushBeforeTransactionCompletion, getSqlExceptionHelper
-
Methods inherited from interface org.hibernate.engine.jdbc.LobCreationContext
fromContext
-
Methods inherited from interface org.hibernate.engine.spi.SharedSessionContractImplementor
afterOperation, afterScrollOperation, asEventSource, asSessionImplementor, asStatelessSession, autoFlushIfRequired, autoFlushIfRequired, autoPreFlush, bestGuessEntityName, bestGuessEntityName, checkOpen, flush, getContextEntityIdentifier, getEntityPersister, getEntityUsingInterceptor, getLoadQueryInfluencers, getPersistenceContext, getPersistenceContextInternal, getSession, getSessionFactory, getTypeConfiguration, guessEntityName, immediateLoad, initializeCollection, instantiate, instantiate, internalLoad, isAutoCloseSessionEnabled, isDefaultReadOnly, isEnforcingFetchGraph, isEventSource, isSessionImplementor, isStatelessSession, setAutoClear, setEnforcingFetchGraph, shouldAutoClose
-
Methods inherited from interface org.hibernate.type.descriptor.WrapperOptions
getDialect
-
-
-
-
Field Detail
-
fastSessionServices
protected transient FastSessionServices fastSessionServices
-
closed
protected boolean closed
-
waitingForAutoClose
protected boolean waitingForAutoClose
-
-
Constructor Detail
-
AbstractSharedSessionContract
public AbstractSharedSessionContract(SessionFactoryImpl factory, SessionCreationOptions options)
-
-
Method Detail
-
setUpMultitenancy
protected final void setUpMultitenancy(SessionFactoryImplementor factory, LoadQueryInfluencers loadQueryInfluencers)
-
getConfiguredJdbcBatchSize
public Integer getConfiguredJdbcBatchSize()
Override the implementation provided on SharedSessionContractImplementor which is not very efficient: this method is hot in Hibernate Reactive, and could be hot in some ORM contexts as well.- Specified by:
getConfiguredJdbcBatchSizein interfaceSharedSessionContractImplementor- Returns:
- the session-level JDBC batch size is set, or the factory-level setting otherwise
- See Also:
SessionFactoryOptions.getJdbcBatchSize(),SessionFactoryBuilder.applyJdbcBatchSize(int)
-
addSharedSessionTransactionObserver
protected void addSharedSessionTransactionObserver(TransactionCoordinator transactionCoordinator)
-
removeSharedSessionTransactionObserver
protected void removeSharedSessionTransactionObserver(TransactionCoordinator transactionCoordinator)
-
prepareForAutoClose
protected void prepareForAutoClose()
-
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).
-
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
-
getInterceptor
public Interceptor getInterceptor()
Description copied from interface:SharedSessionContractImplementorRetrieves theInterceptorassociated with this session.- Specified by:
getInterceptorin interfaceSharedSessionContractImplementor
-
getJdbcCoordinator
public JdbcCoordinator getJdbcCoordinator()
Description copied from interface:SharedSessionContractImplementorObtain theJdbcCoordinatorfor this session.- Specified by:
getJdbcCoordinatorin interfaceSharedSessionContractImplementor
-
getTransactionCoordinator
public TransactionCoordinator getTransactionCoordinator()
Description copied from interface:JdbcSessionOwnerObtain the builder for TransactionCoordinator instances- Specified by:
getTransactionCoordinatorin interfaceJdbcSessionOwner- Returns:
- The TransactionCoordinatorBuilder
-
getJdbcSessionContext
public JdbcSessionContext getJdbcSessionContext()
- Specified by:
getJdbcSessionContextin interfaceJdbcSessionOwner
-
getEntityNameResolver
public EntityNameResolver getEntityNameResolver()
-
getEventListenerManager
public SessionEventListenerManager getEventListenerManager()
Description copied from interface:SharedSessionContractImplementorGet theSessionEventListenerManagerassociated with this session.- Specified by:
getEventListenerManagerin 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
-
getSessionToken
public Object getSessionToken()
Description copied from interface:SharedSessionContractImplementorObtain a "token" which uniquely identifies this session.- Specified by:
getSessionTokenin interfaceSharedSessionContractImplementor
-
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
-
isOpen
public boolean isOpen()
Description copied from interface:SharedSessionContractCheck if the session is still open.- Specified by:
isOpenin interfaceSharedSessionContract- Returns:
- boolean
-
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.
-
close
public void close()
Description 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
-
setClosed
protected void setClosed()
-
shouldCloseJdbcCoordinatorOnClose
protected boolean shouldCloseJdbcCoordinatorOnClose(boolean isTransactionCoordinatorShared)
-
cleanupOnClose
protected void cleanupOnClose()
-
isOpenOrWaitingForAutoClose
public boolean isOpenOrWaitingForAutoClose()
Description copied from interface:SharedSessionContractImplementorDetermines whether the session is open or is waiting for auto-close.- Specified by:
isOpenOrWaitingForAutoClosein interfaceSharedSessionContractImplementor- Returns:
trueif the session is closed, or if it's waiting for auto-close;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
-
checkOpenOrWaitingForAutoClose
protected void checkOpenOrWaitingForAutoClose()
-
markForRollbackOnly
public void markForRollbackOnly()
Description copied from interface:SharedSessionContractImplementorMarks current transaction, if any, for rollback only.- Specified by:
markForRollbackOnlyin 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
-
checkTransactionNeededForUpdateOperation
public void checkTransactionNeededForUpdateOperation(String exceptionMessage)
Description copied from interface:SharedSessionContractImplementorCheck if an activeTransactionis available before performing an update operation against the database.If an active transaction is necessary, but no transaction is active, a
TransactionRequiredExceptionis raised.- Specified by:
checkTransactionNeededForUpdateOperationin interfaceSharedSessionContractImplementor- Parameters:
exceptionMessage- the message to use for theTransactionRequiredException
-
getTransaction
public Transaction getTransaction() throws HibernateException
Description copied from interface:SharedSessionContractGet theTransactioninstance associated with this session.- Specified by:
getTransactionin interfaceSharedSessionContract- Returns:
- a Transaction instance
- Throws:
HibernateException- See Also:
EntityManager.getTransaction()
-
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
-
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
-
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)?
-
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
-
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()
-
checkTransactionSynchStatus
protected void checkTransactionSynchStatus()
-
pulseTransactionCoordinator
protected void pulseTransactionCoordinator()
-
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()
-
delayedAfterCompletion
protected void delayedAfterCompletion()
-
getCurrentTransaction
protected TransactionImplementor getCurrentTransaction()
-
isConnected
public boolean isConnected()
Description copied from interface:SharedSessionContractCheck if the session is currently connected.- Specified by:
isConnectedin interfaceSharedSessionContract- Returns:
- boolean
-
getJdbcConnectionAccess
public JdbcConnectionAccess getJdbcConnectionAccess()
- Specified by:
getJdbcConnectionAccessin interfaceJdbcSessionOwner
-
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
-
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()
-
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.
-
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
-
getJdbcServices
public JdbcServices getJdbcServices()
Description copied from interface:SharedSessionContractImplementorObtain theJdbcServicesfor the factory which created this session.- Specified by:
getJdbcServicesin 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
-
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 cacheMode)
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
-
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
-
interpretHql
protected <R> HqlInterpretation<R> interpretHql(String hql, Class<R> resultType)
-
checkSelectionQuery
protected static void checkSelectionQuery(String hql, HqlInterpretation<?> hqlInterpretation)
-
checkResultType
protected static <R> void checkResultType(Class<R> expectedResultType, SqmSelectionQueryImpl<R> query)
-
createSelectionQuery
public <R> SelectionQuery<R> createSelectionQuery(String hqlString, Class<R> expectedResultType)
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 stringexpectedResultType- 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> expectedResultType)
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 queryexpectedResultType- 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
-
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, 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
-
getResultSetMappingMemento
protected NamedResultSetMappingMemento getResultSetMappingMemento(String resultSetMappingName)
-
createNativeQuery
public NativeQueryImplementor createNativeQuery(String sqlString, @Nullable 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
-
addResultType
@Deprecated(forRemoval=true) protected <T> void addResultType(Class<T> resultClass, NativeQueryImplementor<T> query)
Deprecated, for removal: This API element is subject to removal in a future version.
-
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 <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
-
getNamedQuery
public QueryImplementor getNamedQuery(String queryName)
Description copied from interface:QueryProducerCreate aQueryinstance for the named query.- Specified by:
getNamedQueryin interfaceQueryProducer- Specified by:
getNamedQueryin interfaceQueryProducerImplementor- Parameters:
queryName- the name of a predefined named query- Returns:
- The
Queryinstance for manipulation and execution
-
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 <R> QueryImplementor<R> createNamedQuery(String name, Class<R> 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 queryName)
Description copied from interface:QueryProducerCreate aSelectionQueryinstance for the namedNamedQuery.- Specified by:
createNamedSelectionQueryin interfaceQueryProducer
-
createNamedSelectionQuery
public <R> SelectionQuery<R> createNamedSelectionQuery(String queryName, Class<R> expectedResultType)
Description copied from interface:QueryProducerCreate aSelectionQueryinstance for the namedNamedQuerywith the given result type.- Specified by:
createNamedSelectionQueryin interfaceQueryProducer
-
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
-
applyQuerySettingsAndHints
protected void applyQuerySettingsAndHints(SelectionQuery<?> query)
-
applyQuerySettingsAndHints
protected void applyQuerySettingsAndHints(Query<?> query)
-
buildNamedQuery
protected <Q> Q buildNamedQuery(String queryName, Function<NamedSqmQueryMemento,Q> sqlCreator, Function<NamedNativeQueryMemento,Q> nativeCreator)
-
buildNamedQuery
protected <T> QueryImplementor<T> buildNamedQuery(String queryName, Class<T> resultType)
-
createNativeQueryImplementor
protected <T> NativeQueryImplementor<T> createNativeQueryImplementor(Class<T> resultType, NamedNativeQueryMemento memento)
-
createSqmQueryImplementor
protected <T> SqmQueryImplementor<T> createSqmQueryImplementor(Class<T> resultType, NamedSqmQueryMemento memento)
-
getNamedNativeQuery
public NativeQueryImplementor getNamedNativeQuery(String queryName)
Description copied from interface:QueryProducerGet aNativeQueryinstance for a named native SQL query- Specified by:
getNamedNativeQueryin interfaceQueryProducer- Specified by:
getNamedNativeQueryin interfaceQueryProducerImplementor- Parameters:
queryName- The name of the predefined query- Returns:
- The
NativeQueryinstance for manipulation and execution
-
getNamedNativeQuery
public NativeQueryImplementor getNamedNativeQuery(String queryName, String resultSetMapping)
Description copied from interface:QueryProducerGet aNativeQueryinstance for a named native SQL query- Specified by:
getNamedNativeQueryin interfaceQueryProducer- Specified by:
getNamedNativeQueryin interfaceQueryProducerImplementor- Parameters:
queryName- The name of the predefined query- Returns:
- The
NativeQueryinstance for manipulation and execution
-
createMutationQuery
public MutationQuery createMutationQuery(String hqlString)
Description copied from interface:QueryProducerCreate aMutationQueryreference for the given HQL insert, update, or delete statement.- Specified by:
createMutationQueryin interfaceQueryProducer- Specified by:
createMutationQueryin interfaceQueryProducerImplementor
-
checkMutationQuery
protected static void checkMutationQuery(String hqlString, SqmStatement<?> sqmStatement)
-
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
-
createNamedMutationQuery
public MutationQuery createNamedMutationQuery(String queryName)
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
-
createNativeQueryImplementor
protected NativeQueryImplementor<?> createNativeQueryImplementor(String queryName, NamedNativeQueryMemento memento)
-
createSqmQueryImplementor
protected SqmQueryImplementor<?> createSqmQueryImplementor(String queryName, NamedSqmQueryMemento memento)
-
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
-
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
-
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
-
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.
-
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.
-
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.
-
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)
-
getCriteriaBuilder
public HibernateCriteriaBuilder getCriteriaBuilder()
Description copied from interface:SharedSessionContract- Specified by:
getCriteriaBuilderin interfaceSharedSessionContract- Returns:
- an instance of
HibernateCriteriaBuilder - See Also:
SessionFactory.getCriteriaBuilder()
-
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 criteriaUpdate)
Description copied from interface:QueryProducerCreate aMutationQueryfor the given JPACriteriaUpdate- Specified by:
createQueryin interfaceQueryProducer- Specified by:
createQueryin interfaceQueryProducerImplementor
-
createQuery
public QueryImplementor createQuery(CriteriaDelete criteriaDelete)
Description copied from interface:QueryProducerCreate aMutationQueryfor the given JPACriteriaDelete- Specified by:
createQueryin interfaceQueryProducer- Specified by:
createQueryin interfaceQueryProducerImplementor
-
createEntityGraph
public <T> RootGraphImplementor<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 <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)
-
createEntityGraph
public RootGraphImplementor<?> 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)
-
getEntityGraph
public RootGraphImplementor<?> 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)
-
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.
-
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
-
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.
-
-