Package org.hibernate.engine.spi
Class SessionDelegatorBaseImpl
- java.lang.Object
-
- org.hibernate.engine.spi.SessionDelegatorBaseImpl
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Serializable
,java.lang.AutoCloseable
,EntityManager
,HibernateEntityManager
,LobCreationContext
,SessionImplementor
,SharedSessionContractImplementor
,HibernateEntityManager
,HibernateEntityManagerFactoryAware
,HibernateEntityManagerImplementor
,QueryProducer
,QueryProducerImplementor
,JdbcSessionOwner
,TransactionCoordinatorBuilder.Options
,Session
,SharedSessionContract
,WrapperOptions
public class SessionDelegatorBaseImpl extends java.lang.Object implements SessionImplementor
This class is meant to be extended. Wraps and delegates all methods to aSessionImplementor
and aSession
. This is useful for custom implementations of this API so that only some methods need to be overridden (Used by Hibernate Search).- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.hibernate.jpa.spi.HibernateEntityManagerImplementor
HibernateEntityManagerImplementor.QueryOptions
-
Nested classes/interfaces inherited from interface org.hibernate.engine.jdbc.LobCreationContext
LobCreationContext.Callback<T>
-
Nested classes/interfaces inherited from interface org.hibernate.Session
Session.LockRequest
-
-
Field Summary
Fields Modifier and Type Field Description protected SessionImplementor
delegate
-
Constructor Summary
Constructors Constructor Description SessionDelegatorBaseImpl(SessionImplementor delegate)
SessionDelegatorBaseImpl(SessionImplementor delegate, Session session)
Deprecated.(since 5.3) SessionDelegatorBaseImpl should take just one argument, the SessionImplementor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Transaction
accessTransaction()
Provides access to the underlying transaction or creates a new transaction if one does not already exist or is active.void
addEventListeners(SessionEventListener... listeners)
Add one or more listeners to the Sessionvoid
afterScrollOperation()
void
afterTransactionBegin()
A after-begin callback from the coordinator to its owner.void
afterTransactionCompletion(boolean successful, boolean delayed)
An after-completion callback to the owner.void
beforeTransactionCompletion()
A before-completion callback to the owner.Transaction
beginTransaction()
Begin a unit of work and return the associatedTransaction
object.java.lang.String
bestGuessEntityName(java.lang.Object object)
The best guess entity name for an entity not in an associationLockOptions
buildLockOptions(LockModeType lockModeType, java.util.Map<java.lang.String,java.lang.Object> properties)
Given a JPALockModeType
and properties, build a HibernateLockOptions
Session.LockRequest
buildLockRequest(LockOptions lockOptions)
Build a LockRequest that specifies the LockMode, pessimistic lock timeout and lock scope.<T> IdentifierLoadAccess<T>
byId(java.lang.Class<T> entityClass)
Create anIdentifierLoadAccess
instance to retrieve the specified entity by primary key.IdentifierLoadAccess
byId(java.lang.String entityName)
Create anIdentifierLoadAccess
instance to retrieve the specified entity type by primary key.<T> MultiIdentifierLoadAccess<T>
byMultipleIds(java.lang.Class<T> entityClass)
Create aMultiIdentifierLoadAccess
instance to retrieve multiple entities at once as specified by primary key values.MultiIdentifierLoadAccess
byMultipleIds(java.lang.String entityName)
Create aMultiIdentifierLoadAccess
instance to retrieve multiple entities at once as specified by primary key values.<T> NaturalIdLoadAccess<T>
byNaturalId(java.lang.Class<T> entityClass)
Create aNaturalIdLoadAccess
instance to retrieve the specified entity by its natural id.NaturalIdLoadAccess
byNaturalId(java.lang.String entityName)
Create aNaturalIdLoadAccess
instance to retrieve the specified entity by its natural id.<T> SimpleNaturalIdLoadAccess<T>
bySimpleNaturalId(java.lang.Class<T> entityClass)
Create aSimpleNaturalIdLoadAccess
instance to retrieve the specified entity by its simple (single attribute) natural id.SimpleNaturalIdLoadAccess
bySimpleNaturalId(java.lang.String entityName)
Create aSimpleNaturalIdLoadAccess
instance to retrieve the specified entity by its natural id.void
cancelQuery()
Cancel the execution of the current query.void
checkOpen()
Performs a check whether the Session is open, and if not: marks current transaction (if one) for rollback only throws an IllegalStateException (JPA defines the exception type)void
checkOpen(boolean markForRollbackIfClosed)
Performs a check whether the Session is open, and if not: ifmarkForRollbackIfClosed
is true, marks current transaction (if one) for rollback only throws an IllegalStateException (JPA defines the exception type)void
checkTransactionNeededForUpdateOperation(java.lang.String exceptionMessage)
Check if an active Transaction is necessary for the update operation to be executed.void
clear()
Completely clear the session.void
close()
End the session by releasing the JDBC connection and cleaning up.java.sql.Connection
connection()
boolean
contains(java.lang.Object object)
boolean
contains(java.lang.String entityName, java.lang.Object object)
Check if this entity is associated with this Session.Criteria
createCriteria(java.lang.Class persistentClass)
CreateCriteria
instance for the given class (entity or subclasses/implementors).Criteria
createCriteria(java.lang.Class persistentClass, java.lang.String alias)
CreateCriteria
instance for the given class (entity or subclasses/implementors), using a specific alias.Criteria
createCriteria(java.lang.String entityName)
CreateCriteria
instance for the given entity name.Criteria
createCriteria(java.lang.String entityName, java.lang.String alias)
CreateCriteria
instance for the given entity name, using a specific alias.<T> EntityGraph<T>
createEntityGraph(java.lang.Class<T> rootType)
EntityGraph<?>
createEntityGraph(java.lang.String graphName)
Query
createFilter(java.lang.Object collection, java.lang.String queryString)
Create aQuery
instance for the given collection and filter string.QueryImplementor
createNamedQuery(java.lang.String name)
The JPA-defined named query creation method.<T> QueryImplementor<T>
createNamedQuery(java.lang.String name, java.lang.Class<T> resultClass)
The JPA-defined named, typed query creation method.StoredProcedureQuery
createNamedStoredProcedureQuery(java.lang.String name)
NativeQueryImplementor
createNativeQuery(java.lang.String sqlString)
Create a NativeQuery instance for the given native (SQL) queryNativeQueryImplementor
createNativeQuery(java.lang.String sqlString, java.lang.Class resultClass)
Create a NativeQuery instance for the given native (SQL) query using implicit mapping to the specified Java type.NativeQueryImplementor
createNativeQuery(java.lang.String sqlString, java.lang.String resultSetMapping)
Create a NativeQuery instance for the given native (SQL) query using implicit mapping to the specified Java type.QueryImplementor
createQuery(java.lang.String queryString)
Create aQuery
instance for the given HQL/JPQL query string.<T> QueryImplementor<T>
createQuery(java.lang.String queryString, java.lang.Class<T> resultType)
Create a typedQuery
instance for the given HQL/JPQL query string.<T> QueryImplementor<T>
createQuery(java.lang.String jpaqlString, java.lang.Class<T> resultClass, Selection selection, HibernateEntityManagerImplementor.QueryOptions queryOptions)
Used during "compiling" a JPA criteria query.QueryImplementor
createQuery(CriteriaDelete deleteQuery)
<T> QueryImplementor<T>
createQuery(CriteriaQuery<T> criteriaQuery)
QueryImplementor
createQuery(CriteriaUpdate updateQuery)
NativeQueryImplementor
createSQLQuery(java.lang.String queryString)
Create aNativeQuery
instance for the given SQL query string.ProcedureCall
createStoredProcedureCall(java.lang.String procedureName)
Creates a call to a stored procedure.ProcedureCall
createStoredProcedureCall(java.lang.String procedureName, java.lang.Class... resultClasses)
Creates a call to a stored procedure with specific result set entity mappings.ProcedureCall
createStoredProcedureCall(java.lang.String procedureName, java.lang.String... resultSetMappings)
Creates a call to a stored procedure with specific result set entity mappings.StoredProcedureQuery
createStoredProcedureQuery(java.lang.String procedureName)
StoredProcedureQuery
createStoredProcedureQuery(java.lang.String procedureName, java.lang.Class... resultClasses)
StoredProcedureQuery
createStoredProcedureQuery(java.lang.String procedureName, java.lang.String... resultSetMappings)
protected SessionImplementor
delegate()
Returns the underlying delegate.void
delete(java.lang.Object object)
Remove a persistent instance from the datastore.void
delete(java.lang.String entityName, java.lang.Object object)
Remove a persistent instance from the datastore.void
delete(java.lang.String entityName, java.lang.Object child, boolean isCascadeDeleteEnabled, java.util.Set transientEntities)
void
detach(java.lang.Object entity)
void
disableFetchProfile(java.lang.String name)
Disable a particular fetch profile on this session.void
disableFilter(java.lang.String filterName)
Disable the named filter for the current session.java.sql.Connection
disconnect()
Disconnect the session from its underlying JDBC connection.<T> T
doReturningWork(ReturningWork<T> work)
Controller for allowing users to perform JDBC related work using the Connection managed by this Session.void
doWork(Work work)
Controller for allowing users to perform JDBC related work using the Connection managed by this Session.void
enableFetchProfile(java.lang.String name)
Enable a particular fetch profile on this session.Filter
enableFilter(java.lang.String filterName)
Enable the named filter for this current session.void
evict(java.lang.Object object)
Remove this instance from the session cache.<T> T
execute(LobCreationContext.Callback<T> callback)
Execute the given callback, making sure it has access to a viable JDBCConnection
.int
executeNativeUpdate(NativeSQLQuerySpecification specification, QueryParameters queryParameters)
Execute a native SQL update or delete queryint
executeUpdate(java.lang.String query, QueryParameters queryParameters)
Execute a HQL update or delete query<T> T
find(java.lang.Class<T> entityClass, java.lang.Object primaryKey)
<T> T
find(java.lang.Class<T> entityClass, java.lang.Object primaryKey, java.util.Map<java.lang.String,java.lang.Object> properties)
<T> T
find(java.lang.Class<T> entityClass, java.lang.Object primaryKey, LockModeType lockMode)
<T> T
find(java.lang.Class<T> entityClass, java.lang.Object primaryKey, LockModeType lockMode, java.util.Map<java.lang.String,java.lang.Object> properties)
void
flush()
Force this session to flush.void
flushBeforeTransactionCompletion()
void
forceFlush(EntityEntry e)
EntityKey
generateEntityKey(java.io.Serializable id, EntityPersister persister)
Hide the changing requirements of entity key creation<T> T
get(java.lang.Class<T> theClass, java.io.Serializable id)
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.<T> T
get(java.lang.Class<T> theClass, java.io.Serializable id, LockMode lockMode)
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.<T> T
get(java.lang.Class<T> theClass, java.io.Serializable id, LockOptions lockOptions)
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.java.lang.Object
get(java.lang.String entityName, java.io.Serializable id)
Return the persistent instance of the given named entity with the given identifier, or null if there is no such persistent instance.java.lang.Object
get(java.lang.String entityName, java.io.Serializable id, LockMode lockMode)
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.java.lang.Object
get(java.lang.String entityName, java.io.Serializable id, LockOptions lockOptions)
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.ActionQueue
getActionQueue()
CacheMode
getCacheMode()
Get the current cache mode.CacheTransactionSynchronization
getCacheTransactionSynchronization()
The current CacheTransactionContext associated with the Session.java.io.Serializable
getContextEntityIdentifier(java.lang.Object object)
Return the identifier of the persistent object, or null if not associated with the sessionCriteriaBuilder
getCriteriaBuilder()
LockMode
getCurrentLockMode(java.lang.Object object)
Determine the current lock mode of the given object.java.lang.Object
getDelegate()
This is an implementation of EntityManager#getDelegate().int
getDontFlushFromFind()
Filter
getEnabledFilter(java.lang.String filterName)
Retrieve a currently enabled filter by name.EntityGraph<?>
getEntityGraph(java.lang.String graphName)
<T> java.util.List<EntityGraph<? super T>>
getEntityGraphs(java.lang.Class<T> entityClass)
EntityManagerFactory
getEntityManagerFactory()
java.lang.String
getEntityName(java.lang.Object object)
Return the entity name for a persistent entity.EntityPersister
getEntityPersister(java.lang.String entityName, java.lang.Object object)
Get the EntityPersister for any instancejava.lang.Object
getEntityUsingInterceptor(EntityKey key)
Get the entity instance associated with the given Key, calling the Interceptor if necessarySessionEventListenerManager
getEventListenerManager()
ExceptionConverter
getExceptionConverter()
SessionFactoryImplementor
getFactory()
Get the creating SessionFactoryImplementorFlushModeType
getFlushMode()
FlushMode
getHibernateFlushMode()
Get the current flush mode for this session.java.io.Serializable
getIdentifier(java.lang.Object object)
Return the identifier value of the given entity as associated with this session.Interceptor
getInterceptor()
Retrieves the interceptor currently in use by this event source.java.lang.Integer
getJdbcBatchSize()
Get the Session-level JDBC batch size for the current Session.JdbcConnectionAccess
getJdbcConnectionAccess()
JdbcCoordinator
getJdbcCoordinator()
JdbcServices
getJdbcServices()
JdbcSessionContext
getJdbcSessionContext()
java.util.TimeZone
getJdbcTimeZone()
The JDBCTimeZone
used when persisting Timestamp and DateTime properties into the database.LoadQueryInfluencers
getLoadQueryInfluencers()
Get the load query influencers associated with this session.LobCreator
getLobCreator()
Obtain access to theLobCreator
LobHelper
getLobHelper()
Retrieve this session's helper/delegate for creating LOB instances.LockModeType
getLockMode(java.lang.Object entity)
LockOptions
getLockRequest(LockModeType lockModeType, java.util.Map<java.lang.String,java.lang.Object> properties)
Convert from JPA 2LockModeType
& properties intoLockOptions
Metamodel
getMetamodel()
NativeQueryImplementor
getNamedNativeQuery(java.lang.String name)
Get a NativeQuery instance for a named native SQL queryProcedureCall
getNamedProcedureCall(java.lang.String name)
Gets a ProcedureCall based on a named templateQueryImplementor
getNamedQuery(java.lang.String name)
Create aQuery
instance for the named query.NativeQueryImplementor
getNamedSQLQuery(java.lang.String name)
Get a NativeQuery instance for a named native SQL queryPersistenceContext
getPersistenceContext()
Get the persistence context for this sessionjava.util.Map<java.lang.String,java.lang.Object>
getProperties()
<T> T
getReference(java.lang.Class<T> entityClass, java.lang.Object primaryKey)
SessionImplementor
getSession()
Retrieve a reference to the HibernateSession
used by thisEntityManager
.SessionFactoryImplementor
getSessionFactory()
Get the session factory which created this session.java.util.UUID
getSessionIdentifier()
A UUID associated with each Session.SessionStatistics
getStatistics()
Get the statistics for this session.java.lang.String
getTenantIdentifier()
Obtain the tenant identifier associated with this session.long
getTimestamp()
Transaction
getTransaction()
Get theTransaction
instance associated with this session.TransactionCoordinator
getTransactionCoordinator()
Obtain the builder for TransactionCoordinator instanceslong
getTransactionStartTimestamp()
A "timestamp" at or before the start of the current transaction.TypeHelper
getTypeHelper()
Convenience access to theTypeHelper
associated with this session'sSessionFactory
.java.lang.String
guessEntityName(java.lang.Object entity)
The guessed entity name for an entity not in an associationjava.lang.Object
immediateLoad(java.lang.String entityName, java.io.Serializable id)
Load an instance immediately.void
initializeCollection(PersistentCollection collection, boolean writing)
Initialize the collection (if not already initialized)java.lang.Object
instantiate(java.lang.String entityName, java.io.Serializable id)
Instantiate the entity class, initializing with the given identifierjava.lang.Object
instantiate(EntityPersister persister, java.io.Serializable id)
java.lang.Object
internalLoad(java.lang.String entityName, java.io.Serializable id, boolean eager, boolean nullable)
Load an instance without checking if it was deleted.boolean
isAutoCloseSessionEnabled()
boolean
isClosed()
Checks whether the session is closed.boolean
isConnected()
Check if the session is currently connected.boolean
isDefaultReadOnly()
Will entities and proxies that are loaded into this session be made read-only by default? To determine the read-only/modifiable setting for a particular entity or proxy:boolean
isDirty()
Does this session contain any changes which must be synchronized with the database? In other words, would any DML operations be executed if we flushed this session?boolean
isEventSource()
boolean
isFetchProfileEnabled(java.lang.String name)
Is a particular fetch profile enabled on this session?boolean
isFlushBeforeCompletionEnabled()
boolean
isJoinedToTransaction()
boolean
isOpen()
Check if the session is still open.boolean
isOpenOrWaitingForAutoClose()
Checks whether the session is open or is waiting for auto-closeboolean
isQueryParametersValidationEnabled()
boolean
isReadOnly(java.lang.Object entityOrProxy)
Is the specified entity or proxy read-only? To get the default read-only/modifiable setting used for entities and proxies that are loaded into the session:boolean
isTransactionInProgress()
Does this Session have an active Hibernate transaction or is there a JTA transaction in progress?java.util.Iterator
iterate(java.lang.String query, QueryParameters queryParameters)
Execute an iterate() queryjava.util.Iterator
iterateFilter(java.lang.Object collection, java.lang.String filter, QueryParameters queryParameters)
Iterate a filtervoid
joinTransaction()
java.util.List
list(java.lang.String query, QueryParameters queryParameters)
Execute a find() queryjava.util.List
list(Criteria criteria)
Execute a criteria queryjava.util.List
list(NativeSQLQuerySpecification spec, QueryParameters queryParameters)
Execute a native SQL query, and return the results as a fully built list.java.util.List
listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
Execute an SQL Queryjava.util.List
listFilter(java.lang.Object collection, java.lang.String filter, QueryParameters queryParameters)
Execute a filter<T> T
load(java.lang.Class<T> theClass, java.io.Serializable id)
Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists.<T> T
load(java.lang.Class<T> theClass, java.io.Serializable id, LockMode lockMode)
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.<T> T
load(java.lang.Class<T> theClass, java.io.Serializable id, LockOptions lockOptions)
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.void
load(java.lang.Object object, java.io.Serializable id)
Read the persistent state associated with the given identifier into the given transient instance.java.lang.Object
load(java.lang.String entityName, java.io.Serializable id)
Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists.java.lang.Object
load(java.lang.String entityName, java.io.Serializable id, LockMode lockMode)
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.java.lang.Object
load(java.lang.String entityName, java.io.Serializable id, LockOptions lockOptions)
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.void
lock(java.lang.Object entity, LockModeType lockMode)
void
lock(java.lang.Object entity, LockModeType lockMode, java.util.Map<java.lang.String,java.lang.Object> properties)
void
lock(java.lang.Object object, LockMode lockMode)
Obtain the specified lock level upon the given object.void
lock(java.lang.String entityName, java.lang.Object object, LockMode lockMode)
Obtain the specified lock level upon the given object.void
markForRollbackOnly()
Marks current transaction (if one) for rollback onlyjava.lang.Object
merge(java.lang.Object object)
Copy the state of the given object onto the persistent object with the same identifier.java.lang.Object
merge(java.lang.String entityName, java.lang.Object object)
Copy the state of the given object onto the persistent object with the same identifier.void
merge(java.lang.String entityName, java.lang.Object object, java.util.Map copiedAlready)
void
persist(java.lang.Object object)
Make a transient instance persistent.void
persist(java.lang.String entityName, java.lang.Object object)
Make a transient instance persistent.void
persist(java.lang.String entityName, java.lang.Object object, java.util.Map createdAlready)
void
persistOnFlush(java.lang.String entityName, java.lang.Object object, java.util.Map copiedAlready)
void
reconnect(java.sql.Connection connection)
Reconnect to the given JDBC connection.void
refresh(java.lang.Object object)
Re-read the state of the given instance from the underlying database.void
refresh(java.lang.Object entity, java.util.Map<java.lang.String,java.lang.Object> properties)
void
refresh(java.lang.Object entity, LockModeType lockMode)
void
refresh(java.lang.Object entity, LockModeType lockMode, java.util.Map<java.lang.String,java.lang.Object> properties)
void
refresh(java.lang.Object object, LockMode lockMode)
Re-read the state of the given instance from the underlying database, with the given LockMode.void
refresh(java.lang.Object object, LockOptions lockOptions)
Re-read the state of the given instance from the underlying database, with the given LockMode.void
refresh(java.lang.String entityName, java.lang.Object object)
Re-read the state of the given instance from the underlying database.void
refresh(java.lang.String entityName, java.lang.Object object, java.util.Map refreshedAlready)
void
refresh(java.lang.String entityName, java.lang.Object object, LockOptions lockOptions)
Re-read the state of the given instance from the underlying database, with the given LockMode.SqlTypeDescriptor
remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor)
Allow remapping of descriptors for dealing with sql type.void
remove(java.lang.Object entity)
void
removeOrphanBeforeUpdates(java.lang.String entityName, java.lang.Object child)
void
replicate(java.lang.Object object, ReplicationMode replicationMode)
Persist the state of the given detached instance, reusing the current identifier value.void
replicate(java.lang.String entityName, java.lang.Object object, ReplicationMode replicationMode)
Persist the state of the given detached instance, reusing the current identifier value.java.io.Serializable
save(java.lang.Object object)
Persist the given transient instance, first assigning a generated identifier.java.io.Serializable
save(java.lang.String entityName, java.lang.Object object)
Persist the given transient instance, first assigning a generated identifier.void
saveOrUpdate(java.lang.Object object)
EitherSession.save(Object)
orSession.update(Object)
the given instance, depending upon resolution of the unsaved-value checks (see the manual for discussion of unsaved-value checking).void
saveOrUpdate(java.lang.String entityName, java.lang.Object object)
EitherSession.save(String, Object)
orSession.update(String, Object)
the given instance, depending upon resolution of the unsaved-value checks (see the manual for discussion of unsaved-value checking).ScrollableResultsImplementor
scroll(java.lang.String query, QueryParameters queryParameters)
Execute a scroll() queryScrollableResultsImplementor
scroll(Criteria criteria, ScrollMode scrollMode)
Execute a criteria queryScrollableResultsImplementor
scroll(NativeSQLQuerySpecification spec, QueryParameters queryParameters)
Execute a native SQL query, and return the results as a scrollable result.ScrollableResultsImplementor
scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
Execute an SQL QuerySharedSessionBuilder
sessionWithOptions()
Obtain aSession
builder with the ability to grab certain information from this session.void
setAutoClear(boolean enabled)
Enable/disable automatic cache clearing from after transaction completion (for EJB3)void
setCacheMode(CacheMode cm)
Set the cache mode.void
setDefaultReadOnly(boolean readOnly)
Change the default for entities and proxies loaded into this session from modifiable to read-only mode, or from modifiable to read-only mode.void
setFlushMode(FlushModeType flushModeType)
void
setFlushMode(FlushMode fm)
Set the flush mode for this session.void
setHibernateFlushMode(FlushMode flushMode)
Set the flush mode for this session.void
setJdbcBatchSize(java.lang.Integer jdbcBatchSize)
Set the Session-level JDBC batch size.void
setProperty(java.lang.String propertyName, java.lang.Object value)
void
setReadOnly(java.lang.Object entityOrProxy, boolean readOnly)
Set an unmodified persistent object to read-only mode, or a read-only object to modifiable mode.boolean
shouldAutoClose()
boolean
shouldAutoJoinTransaction()
Indicates whether an active transaction should be automatically joined.void
startTransactionBoundary()
Callback indicating recognition of entering into a transactional context whether that is explicitly via the HibernateTransaction
API or via registration of Hibernate's JTA Synchronization impl with a JTA Transaction<T> T
unwrap(java.lang.Class<T> cls)
void
update(java.lang.Object object)
Update the persistent instance with the identifier of the given detached instance.void
update(java.lang.String entityName, java.lang.Object object)
Update the persistent instance with the identifier of the given detached instance.boolean
useStreamForLobBinding()
Should streams 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.engine.spi.SharedSessionContractImplementor
getConfiguredJdbcBatchSize
-
-
-
-
Field Detail
-
delegate
protected final SessionImplementor delegate
-
-
Constructor Detail
-
SessionDelegatorBaseImpl
@Deprecated public SessionDelegatorBaseImpl(SessionImplementor delegate, Session session)
Deprecated.(since 5.3) SessionDelegatorBaseImpl should take just one argument, the SessionImplementor. Use theSessionDelegatorBaseImpl(SessionImplementor)
form instead
-
SessionDelegatorBaseImpl
public SessionDelegatorBaseImpl(SessionImplementor delegate)
-
-
Method Detail
-
delegate
protected SessionImplementor delegate()
Returns the underlying delegate. Be careful that it has a different behavior from thegetDelegate()
method coming from the EntityManager interface which returns the current session.- See Also:
getDelegate()
-
execute
public <T> T execute(LobCreationContext.Callback<T> callback)
Description copied from interface:LobCreationContext
Execute the given callback, making sure it has access to a viable JDBCConnection
.- Specified by:
execute
in 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.
-
getTenantIdentifier
public java.lang.String getTenantIdentifier()
Description copied from interface:SharedSessionContract
Obtain the tenant identifier associated with this session.- Specified by:
getTenantIdentifier
in interfaceSharedSessionContract
- Specified by:
getTenantIdentifier
in interfaceSharedSessionContractImplementor
- Returns:
- The tenant identifier associated with this session, or
null
-
getSessionIdentifier
public java.util.UUID getSessionIdentifier()
Description copied from interface:SharedSessionContractImplementor
A UUID associated with each Session. Useful mainly for logging.- Specified by:
getSessionIdentifier
in interfaceSharedSessionContractImplementor
- Returns:
- The UUID
-
getJdbcConnectionAccess
public JdbcConnectionAccess getJdbcConnectionAccess()
- Specified by:
getJdbcConnectionAccess
in interfaceJdbcSessionOwner
-
generateEntityKey
public EntityKey generateEntityKey(java.io.Serializable id, EntityPersister persister)
Description copied from interface:SharedSessionContractImplementor
Hide the changing requirements of entity key creation- Specified by:
generateEntityKey
in interfaceSharedSessionContractImplementor
- Parameters:
id
- The entity idpersister
- The entity persister- Returns:
- The entity key
-
getInterceptor
public Interceptor getInterceptor()
Description copied from interface:SharedSessionContractImplementor
Retrieves the interceptor currently in use by this event source.- Specified by:
getInterceptor
in interfaceSharedSessionContractImplementor
- Returns:
- The interceptor.
-
setAutoClear
public void setAutoClear(boolean enabled)
Description copied from interface:SharedSessionContractImplementor
Enable/disable automatic cache clearing from after transaction completion (for EJB3)- Specified by:
setAutoClear
in interfaceSharedSessionContractImplementor
-
isTransactionInProgress
public boolean isTransactionInProgress()
Description copied from interface:SharedSessionContractImplementor
Does this Session have an active Hibernate transaction or is there a JTA transaction in progress?- Specified by:
isTransactionInProgress
in interfaceHibernateEntityManagerImplementor
- Specified by:
isTransactionInProgress
in interfaceSharedSessionContractImplementor
- Returns:
- True if a transaction is considered currently in progress; false otherwise.
-
checkTransactionNeededForUpdateOperation
public void checkTransactionNeededForUpdateOperation(java.lang.String exceptionMessage)
Description copied from interface:SharedSessionContractImplementor
Check if an active Transaction is necessary for the update operation to be executed. If an active Transaction is necessary but it is not then a TransactionRequiredException is raised.- Specified by:
checkTransactionNeededForUpdateOperation
in interfaceSharedSessionContractImplementor
- Parameters:
exceptionMessage
- the message to use for the TransactionRequiredException
-
getLockRequest
public LockOptions getLockRequest(LockModeType lockModeType, java.util.Map<java.lang.String,java.lang.Object> properties)
Description copied from interface:HibernateEntityManagerImplementor
Convert from JPA 2LockModeType
& properties intoLockOptions
- Specified by:
getLockRequest
in interfaceHibernateEntityManagerImplementor
- Parameters:
lockModeType
- is the requested lock typeproperties
- are the lock properties- Returns:
- the LockOptions
-
buildLockOptions
public LockOptions buildLockOptions(LockModeType lockModeType, java.util.Map<java.lang.String,java.lang.Object> properties)
Description copied from interface:HibernateEntityManagerImplementor
Given a JPALockModeType
and properties, build a HibernateLockOptions
- Specified by:
buildLockOptions
in interfaceHibernateEntityManagerImplementor
- Parameters:
lockModeType
- the requested LockModeTypeproperties
- the lock properties- Returns:
- the LockOptions
-
createQuery
public <T> QueryImplementor<T> createQuery(java.lang.String jpaqlString, java.lang.Class<T> resultClass, Selection selection, HibernateEntityManagerImplementor.QueryOptions queryOptions)
Description copied from interface:SessionImplementor
Used during "compiling" a JPA criteria query.- Specified by:
createQuery
in interfaceHibernateEntityManagerImplementor
- Specified by:
createQuery
in interfaceSessionImplementor
- Type Parameters:
T
- The query type- Parameters:
jpaqlString
- The criteria query rendered as a JPA QL stringresultClass
- The result type (the type expected in the result list)selection
- The selection(s)queryOptions
- The options to use to build the query.- Returns:
- The typed query
-
initializeCollection
public void initializeCollection(PersistentCollection collection, boolean writing) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Initialize the collection (if not already initialized)- Specified by:
initializeCollection
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
internalLoad
public java.lang.Object internalLoad(java.lang.String entityName, java.io.Serializable id, boolean eager, boolean nullable) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Load an instance without checking if it was deleted. When nullable is disabled this method may create a new proxy or return an existing proxy; if it does not exist, throw an exception. When nullable is enabled, the method does not create new proxies (but might return an existing proxy); if it does not exist, return null. When eager is enabled, the object is eagerly fetched- Specified by:
internalLoad
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
immediateLoad
public java.lang.Object immediateLoad(java.lang.String entityName, java.io.Serializable id) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Load an instance immediately. This method is only called when lazily initializing a proxy. Do not return the proxy.- Specified by:
immediateLoad
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
getTimestamp
public long getTimestamp()
- Specified by:
getTimestamp
in interfaceSharedSessionContractImplementor
-
getFactory
public SessionFactoryImplementor getFactory()
Description copied from interface:SharedSessionContractImplementor
Get the creating SessionFactoryImplementor- Specified by:
getFactory
in interfaceHibernateEntityManagerFactoryAware
- Specified by:
getFactory
in interfaceQueryProducerImplementor
- Specified by:
getFactory
in interfaceSharedSessionContractImplementor
- Returns:
- The Hibernate EMF contract for this EM.
-
list
public java.util.List list(java.lang.String query, QueryParameters queryParameters) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Execute a find() query- Specified by:
list
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
iterate
public java.util.Iterator iterate(java.lang.String query, QueryParameters queryParameters) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Execute an iterate() query- Specified by:
iterate
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
scroll
public ScrollableResultsImplementor scroll(java.lang.String query, QueryParameters queryParameters) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Execute a scroll() query- Specified by:
scroll
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
scroll
public ScrollableResultsImplementor scroll(Criteria criteria, ScrollMode scrollMode)
Description copied from interface:SharedSessionContractImplementor
Execute a criteria query- Specified by:
scroll
in interfaceSharedSessionContractImplementor
-
list
public java.util.List list(Criteria criteria)
Description copied from interface:SharedSessionContractImplementor
Execute a criteria query- Specified by:
list
in interfaceSharedSessionContractImplementor
-
listFilter
public java.util.List listFilter(java.lang.Object collection, java.lang.String filter, QueryParameters queryParameters) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Execute a filter- Specified by:
listFilter
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
iterateFilter
public java.util.Iterator iterateFilter(java.lang.Object collection, java.lang.String filter, QueryParameters queryParameters) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Iterate a filter- Specified by:
iterateFilter
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
getEntityPersister
public EntityPersister getEntityPersister(java.lang.String entityName, java.lang.Object object) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Get the EntityPersister for any instance- Specified by:
getEntityPersister
in interfaceSharedSessionContractImplementor
- Parameters:
entityName
- optional entity nameobject
- the entity instance- Throws:
HibernateException
-
getEntityUsingInterceptor
public java.lang.Object getEntityUsingInterceptor(EntityKey key) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Get the entity instance associated with the given Key, calling the Interceptor if necessary- Specified by:
getEntityUsingInterceptor
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
getContextEntityIdentifier
public java.io.Serializable getContextEntityIdentifier(java.lang.Object object)
Description copied from interface:SharedSessionContractImplementor
Return the identifier of the persistent object, or null if not associated with the session- Specified by:
getContextEntityIdentifier
in interfaceSharedSessionContractImplementor
-
bestGuessEntityName
public java.lang.String bestGuessEntityName(java.lang.Object object)
Description copied from interface:SharedSessionContractImplementor
The best guess entity name for an entity not in an association- Specified by:
bestGuessEntityName
in interfaceSharedSessionContractImplementor
-
guessEntityName
public java.lang.String guessEntityName(java.lang.Object entity) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
The guessed entity name for an entity not in an association- Specified by:
guessEntityName
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
instantiate
public java.lang.Object instantiate(java.lang.String entityName, java.io.Serializable id) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Instantiate the entity class, initializing with the given identifier- Specified by:
instantiate
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
listCustomQuery
public java.util.List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Execute an SQL Query- Specified by:
listCustomQuery
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
scrollCustomQuery
public ScrollableResultsImplementor scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Execute an SQL Query- Specified by:
scrollCustomQuery
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
list
public java.util.List list(NativeSQLQuerySpecification spec, QueryParameters queryParameters) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Execute a native SQL query, and return the results as a fully built list.- Specified by:
list
in interfaceSharedSessionContractImplementor
- Parameters:
spec
- The specification of the native SQL query to execute.queryParameters
- The parameters by which to perform the execution.- Returns:
- The result list.
- Throws:
HibernateException
-
scroll
public ScrollableResultsImplementor scroll(NativeSQLQuerySpecification spec, QueryParameters queryParameters) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Execute a native SQL query, and return the results as a scrollable result.- Specified by:
scroll
in interfaceSharedSessionContractImplementor
- Parameters:
spec
- The specification of the native SQL query to execute.queryParameters
- The parameters by which to perform the execution.- Returns:
- The resulting scrollable result.
- Throws:
HibernateException
-
getDontFlushFromFind
public int getDontFlushFromFind()
- Specified by:
getDontFlushFromFind
in interfaceSharedSessionContractImplementor
-
getPersistenceContext
public PersistenceContext getPersistenceContext()
Description copied from interface:SharedSessionContractImplementor
Get the persistence context for this session- Specified by:
getPersistenceContext
in interfaceSharedSessionContractImplementor
-
executeUpdate
public int executeUpdate(java.lang.String query, QueryParameters queryParameters) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Execute a HQL update or delete query- Specified by:
executeUpdate
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
executeNativeUpdate
public int executeNativeUpdate(NativeSQLQuerySpecification specification, QueryParameters queryParameters) throws HibernateException
Description copied from interface:SharedSessionContractImplementor
Execute a native SQL update or delete query- Specified by:
executeNativeUpdate
in interfaceSharedSessionContractImplementor
- Throws:
HibernateException
-
getCacheMode
public CacheMode getCacheMode()
Description copied from interface:Session
Get the current cache mode.- Specified by:
getCacheMode
in interfaceQueryProducerImplementor
- Specified by:
getCacheMode
in interfaceSession
- Specified by:
getCacheMode
in interfaceSharedSessionContractImplementor
- Returns:
- The current cache mode.
-
setCacheMode
public void setCacheMode(CacheMode cm)
Description copied from interface:Session
Set the cache mode. Cache mode determines the manner in which this session can interact with the second level cache.- Specified by:
setCacheMode
in interfaceSession
- Specified by:
setCacheMode
in interfaceSharedSessionContractImplementor
- Parameters:
cm
- The new cache mode.
-
isOpen
public boolean isOpen()
Description copied from interface:SharedSessionContract
Check if the session is still open.- Specified by:
isOpen
in interfaceEntityManager
- Specified by:
isOpen
in interfaceSharedSessionContract
- Returns:
- boolean
-
isConnected
public boolean isConnected()
Description copied from interface:SharedSessionContract
Check if the session is currently connected.- Specified by:
isConnected
in interfaceSharedSessionContract
- Returns:
- boolean
-
checkOpen
public void checkOpen(boolean markForRollbackIfClosed)
Description copied from interface:SharedSessionContractImplementor
Performs a check whether the Session is open, and if not:- if
markForRollbackIfClosed
is true, marks current transaction (if one) for rollback only - throws an IllegalStateException (JPA defines the exception type)
- Specified by:
checkOpen
in interfaceHibernateEntityManagerImplementor
- Specified by:
checkOpen
in interfaceSharedSessionContractImplementor
- Parameters:
markForRollbackIfClosed
- If the EM is closed, should the transaction (if one) be marked for rollback?
- if
-
markForRollbackOnly
public void markForRollbackOnly()
Description copied from interface:SharedSessionContractImplementor
Marks current transaction (if one) for rollback only- Specified by:
markForRollbackOnly
in interfaceHibernateEntityManagerImplementor
- Specified by:
markForRollbackOnly
in interfaceSharedSessionContractImplementor
-
getTransactionStartTimestamp
public long getTransactionStartTimestamp()
Description copied from interface:SharedSessionContractImplementor
A "timestamp" at or before the start of the current transaction.- Specified by:
getTransactionStartTimestamp
in interfaceSharedSessionContractImplementor
-
getFlushMode
public FlushModeType getFlushMode()
Description copied from interface: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 JPAFlushModeType
rather than Hibernate'sFlushMode
. For the former behavior, useSession.getHibernateFlushMode()
instead.- Specified by:
getFlushMode
in interfaceEntityManager
- Specified by:
getFlushMode
in interfaceSession
- Specified by:
getFlushMode
in interfaceSharedSessionContractImplementor
- Returns:
- The FlushModeType in effect for this Session.
-
setFlushMode
public void setFlushMode(FlushModeType flushModeType)
- Specified by:
setFlushMode
in interfaceEntityManager
-
setHibernateFlushMode
public void setHibernateFlushMode(FlushMode flushMode)
Description copied from interface:Session
Set the flush mode for 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 is reasonable to set the session's flush mode toFlushMode.MANUAL
at the start of the session (in order to achieve some extra performance).- Specified by:
setHibernateFlushMode
in interfaceSession
- Specified by:
setHibernateFlushMode
in interfaceSharedSessionContractImplementor
- Parameters:
flushMode
- the new flush mode
-
getHibernateFlushMode
public FlushMode getHibernateFlushMode()
Description copied from interface:Session
Get the current flush mode for this session.- Specified by:
getHibernateFlushMode
in interfaceQueryProducerImplementor
- Specified by:
getHibernateFlushMode
in interfaceSession
- Specified by:
getHibernateFlushMode
in interfaceSharedSessionContractImplementor
- Returns:
- The flush mode
-
setFlushMode
public void setFlushMode(FlushMode fm)
Description copied from interface:Session
Set the flush mode for 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 is reasonable to set the session's flush mode toFlushMode.MANUAL
at the start of the session (in order to achieve some extra performance).- Specified by:
setFlushMode
in interfaceSession
- Specified by:
setFlushMode
in interfaceSharedSessionContractImplementor
- Parameters:
fm
- the new flush mode
-
lock
public void lock(java.lang.Object entity, LockModeType lockMode)
- Specified by:
lock
in interfaceEntityManager
-
lock
public void lock(java.lang.Object entity, LockModeType lockMode, java.util.Map<java.lang.String,java.lang.Object> properties)
- Specified by:
lock
in interfaceEntityManager
-
connection
public java.sql.Connection connection()
- Specified by:
connection
in interfaceSharedSessionContractImplementor
-
flush
public void flush()
Description copied from interface:Session
Force this session to flush. Must be called at the end of a unit of work, before committing the transaction and closing the session (depending onSession.setFlushMode(FlushMode)
,EntityTransaction.commit()
calls this method). Flushing is the process of synchronizing the underlying persistent store with persistable state held in memory.- Specified by:
flush
in interfaceEntityManager
- Specified by:
flush
in interfaceSession
- Specified by:
flush
in interfaceSharedSessionContractImplementor
-
isEventSource
public boolean isEventSource()
- Specified by:
isEventSource
in interfaceSharedSessionContractImplementor
-
afterScrollOperation
public void afterScrollOperation()
- Specified by:
afterScrollOperation
in interfaceSharedSessionContractImplementor
-
getTransactionCoordinator
public TransactionCoordinator getTransactionCoordinator()
Description copied from interface:JdbcSessionOwner
Obtain the builder for TransactionCoordinator instances- Specified by:
getTransactionCoordinator
in interfaceJdbcSessionOwner
- Returns:
- The TransactionCoordinatorBuilder
-
getJdbcCoordinator
public JdbcCoordinator getJdbcCoordinator()
- Specified by:
getJdbcCoordinator
in interfaceSharedSessionContractImplementor
-
getJdbcServices
public JdbcServices getJdbcServices()
- Specified by:
getJdbcServices
in interfaceSharedSessionContractImplementor
-
getJdbcSessionContext
public JdbcSessionContext getJdbcSessionContext()
- Specified by:
getJdbcSessionContext
in interfaceJdbcSessionOwner
-
isClosed
public boolean isClosed()
Description copied from interface:SharedSessionContractImplementor
Checks whether the session is closed. Provided separately fromSharedSessionContract.isOpen()
as this method does not attempt any JTA synchronization registration, whereasSharedSessionContract.isOpen()
does; which makes this one nicer to use for most internal purposes.- Specified by:
isClosed
in interfaceSharedSessionContractImplementor
- Returns:
true
if the session is closed;false
otherwise.
-
checkOpen
public void checkOpen()
Description copied from interface:SharedSessionContractImplementor
Performs a check whether the Session is open, and if not:- marks current transaction (if one) for rollback only
- throws an IllegalStateException (JPA defines the exception type)
- Specified by:
checkOpen
in interfaceSharedSessionContractImplementor
-
isOpenOrWaitingForAutoClose
public boolean isOpenOrWaitingForAutoClose()
Description copied from interface:SharedSessionContractImplementor
Checks whether the session is open or is waiting for auto-close- Specified by:
isOpenOrWaitingForAutoClose
in interfaceSharedSessionContractImplementor
- Returns:
true
if the session is closed or if it's waiting for auto-close;false
otherwise.
-
shouldAutoClose
public boolean shouldAutoClose()
- Specified by:
shouldAutoClose
in interfaceSharedSessionContractImplementor
-
isAutoCloseSessionEnabled
public boolean isAutoCloseSessionEnabled()
- Specified by:
isAutoCloseSessionEnabled
in interfaceSharedSessionContractImplementor
-
isQueryParametersValidationEnabled
public boolean isQueryParametersValidationEnabled()
- Specified by:
isQueryParametersValidationEnabled
in interfaceSharedSessionContractImplementor
-
shouldAutoJoinTransaction
public boolean shouldAutoJoinTransaction()
Description copied from interface:TransactionCoordinatorBuilder.Options
Indicates whether an active transaction should be automatically joined. Only relevant for JTA-based TransactionCoordinator instances.- Specified by:
shouldAutoJoinTransaction
in interfaceTransactionCoordinatorBuilder.Options
- Returns:
true
indicates the active transaction should be auto joined;false
indicates it should not (untilTransactionCoordinator.explicitJoin()
is called).
-
getLoadQueryInfluencers
public LoadQueryInfluencers getLoadQueryInfluencers()
Description copied from interface:SharedSessionContractImplementor
Get the load query influencers associated with this session.- Specified by:
getLoadQueryInfluencers
in interfaceSharedSessionContractImplementor
- Returns:
- the load query influencers associated with this session; should never be null.
-
getExceptionConverter
public ExceptionConverter getExceptionConverter()
- Specified by:
getExceptionConverter
in interfaceSharedSessionContractImplementor
-
getEventListenerManager
public SessionEventListenerManager getEventListenerManager()
- Specified by:
getEventListenerManager
in interfaceSharedSessionContractImplementor
-
accessTransaction
public Transaction accessTransaction()
Description copied from interface:SharedSessionContractImplementor
Provides access to the underlying transaction or creates a new transaction if one does not already exist or is active. This is primarily for internal or integrator use.- Specified by:
accessTransaction
in interfaceSharedSessionContractImplementor
- Returns:
- the transaction
-
beginTransaction
public Transaction beginTransaction()
Description copied from interface:SharedSessionContract
Begin a unit of work and return the associatedTransaction
object. 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:
beginTransaction
in interfaceSharedSessionContract
- Returns:
- a Transaction instance
- See Also:
SharedSessionContract.getTransaction()
-
getTransaction
public Transaction getTransaction()
Description copied from interface:SharedSessionContract
Get theTransaction
instance associated with this session. The concrete type of the returnedTransaction
object is determined by thehibernate.transaction_factory
property.- Specified by:
getTransaction
in interfaceEntityManager
- Specified by:
getTransaction
in interfaceSharedSessionContract
- Returns:
- a Transaction instance
-
startTransactionBoundary
public void startTransactionBoundary()
Description copied from interface:JdbcSessionOwner
Callback indicating recognition of entering into a transactional context whether that is explicitly via the HibernateTransaction
API or via registration of Hibernate's JTA Synchronization impl with a JTA Transaction- Specified by:
startTransactionBoundary
in interfaceJdbcSessionOwner
-
getCacheTransactionSynchronization
public CacheTransactionSynchronization getCacheTransactionSynchronization()
Description copied from interface:SharedSessionContractImplementor
The current CacheTransactionContext associated with the Session. This may returnnull
when the Session is not currently part of a transaction.- Specified by:
getCacheTransactionSynchronization
in interfaceSharedSessionContractImplementor
-
afterTransactionBegin
public void afterTransactionBegin()
Description copied from interface:JdbcSessionOwner
A after-begin callback from the coordinator to its owner.- Specified by:
afterTransactionBegin
in interfaceJdbcSessionOwner
-
beforeTransactionCompletion
public void beforeTransactionCompletion()
Description copied from interface:JdbcSessionOwner
A before-completion callback to the owner.- Specified by:
beforeTransactionCompletion
in interfaceJdbcSessionOwner
-
afterTransactionCompletion
public void afterTransactionCompletion(boolean successful, boolean delayed)
Description copied from interface:JdbcSessionOwner
An after-completion callback to the owner.- Specified by:
afterTransactionCompletion
in 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:
flushBeforeTransactionCompletion
in interfaceJdbcSessionOwner
-
getEntityManagerFactory
public EntityManagerFactory getEntityManagerFactory()
- Specified by:
getEntityManagerFactory
in interfaceEntityManager
-
getCriteriaBuilder
public CriteriaBuilder getCriteriaBuilder()
- Specified by:
getCriteriaBuilder
in interfaceEntityManager
-
getMetamodel
public Metamodel getMetamodel()
- Specified by:
getMetamodel
in interfaceEntityManager
-
createEntityGraph
public <T> EntityGraph<T> createEntityGraph(java.lang.Class<T> rootType)
- Specified by:
createEntityGraph
in interfaceEntityManager
-
createEntityGraph
public EntityGraph<?> createEntityGraph(java.lang.String graphName)
- Specified by:
createEntityGraph
in interfaceEntityManager
-
getEntityGraph
public EntityGraph<?> getEntityGraph(java.lang.String graphName)
- Specified by:
getEntityGraph
in interfaceEntityManager
-
getEntityGraphs
public <T> java.util.List<EntityGraph<? super T>> getEntityGraphs(java.lang.Class<T> entityClass)
- Specified by:
getEntityGraphs
in interfaceEntityManager
-
getNamedQuery
public QueryImplementor getNamedQuery(java.lang.String name)
Description copied from interface:QueryProducer
Create aQuery
instance for the named query.- Specified by:
getNamedQuery
in interfaceQueryProducer
- Specified by:
getNamedQuery
in interfaceQueryProducerImplementor
- Specified by:
getNamedQuery
in interfaceSessionImplementor
- Specified by:
getNamedQuery
in interfaceSharedSessionContract
- Parameters:
name
- the name of a pre-defined, named query- Returns:
- The Query instance for manipulation and execution
-
getNamedSQLQuery
public NativeQueryImplementor getNamedSQLQuery(java.lang.String name)
Description copied from interface:QueryProducer
Get a NativeQuery instance for a named native SQL query- Specified by:
getNamedSQLQuery
in interfaceQueryProducer
- Specified by:
getNamedSQLQuery
in interfaceQueryProducerImplementor
- Specified by:
getNamedSQLQuery
in interfaceSessionImplementor
- Parameters:
name
- The name of the pre-defined query- Returns:
- The NativeQuery instance for manipulation and execution
-
getNamedNativeQuery
public NativeQueryImplementor getNamedNativeQuery(java.lang.String name)
Description copied from interface:QueryProducer
Get a NativeQuery instance for a named native SQL query- Specified by:
getNamedNativeQuery
in interfaceQueryProducer
- Specified by:
getNamedNativeQuery
in interfaceQueryProducerImplementor
- Specified by:
getNamedNativeQuery
in interfaceSessionImplementor
- Parameters:
name
- The name of the pre-defined query- Returns:
- The NativeQuery instance for manipulation and execution
-
createQuery
public QueryImplementor createQuery(java.lang.String queryString)
Description copied from interface:QueryProducer
Create aQuery
instance for the given HQL/JPQL query string.- Specified by:
createQuery
in interfaceEntityManager
- Specified by:
createQuery
in interfaceQueryProducer
- Specified by:
createQuery
in interfaceQueryProducerImplementor
- Specified by:
createQuery
in interfaceSessionImplementor
- Specified by:
createQuery
in interfaceSharedSessionContract
- Parameters:
queryString
- The HQL/JPQL query- Returns:
- The Query instance for manipulation and execution
- See Also:
EntityManager.createQuery(String)
-
createQuery
public <T> QueryImplementor<T> createQuery(java.lang.String queryString, java.lang.Class<T> resultType)
Description copied from interface:QueryProducer
Create a typedQuery
instance for the given HQL/JPQL query string.- Specified by:
createQuery
in interfaceEntityManager
- Specified by:
createQuery
in interfaceQueryProducer
- Specified by:
createQuery
in interfaceQueryProducerImplementor
- Specified by:
createQuery
in interfaceSession
- Specified by:
createQuery
in interfaceSessionImplementor
- Parameters:
queryString
- The HQL/JPQL query- Returns:
- The Query instance for manipulation and execution
- See Also:
EntityManager.createQuery(String,Class)
-
createQuery
public <T> QueryImplementor<T> createQuery(CriteriaQuery<T> criteriaQuery)
- Specified by:
createQuery
in interfaceEntityManager
- Specified by:
createQuery
in interfaceSession
- Specified by:
createQuery
in interfaceSessionImplementor
-
createQuery
public QueryImplementor createQuery(CriteriaUpdate updateQuery)
- Specified by:
createQuery
in interfaceEntityManager
- Specified by:
createQuery
in interfaceSession
- Specified by:
createQuery
in interfaceSessionImplementor
-
createQuery
public QueryImplementor createQuery(CriteriaDelete deleteQuery)
- Specified by:
createQuery
in interfaceEntityManager
- Specified by:
createQuery
in interfaceSession
- Specified by:
createQuery
in interfaceSessionImplementor
-
createNamedQuery
public QueryImplementor createNamedQuery(java.lang.String name)
Description copied from interface:QueryProducer
The JPA-defined named query creation method. This form can represent an HQL/JPQL query or a native query.- Specified by:
createNamedQuery
in interfaceEntityManager
- Specified by:
createNamedQuery
in interfaceQueryProducer
- Specified by:
createNamedQuery
in interfaceQueryProducerImplementor
- Specified by:
createNamedQuery
in interfaceSessionImplementor
- Parameters:
name
- the name of a pre-defined, named query- Returns:
- The Query instance for manipulation and execution
- See Also:
EntityManager.createNamedQuery(String)
-
createNamedQuery
public <T> QueryImplementor<T> createNamedQuery(java.lang.String name, java.lang.Class<T> resultClass)
Description copied from interface:QueryProducer
The JPA-defined named, typed query creation method. This form can only represent an HQL/JPQL query (not a native query).- Specified by:
createNamedQuery
in interfaceEntityManager
- Specified by:
createNamedQuery
in interfaceQueryProducer
- Specified by:
createNamedQuery
in interfaceQueryProducerImplementor
- Specified by:
createNamedQuery
in interfaceSession
- Specified by:
createNamedQuery
in interfaceSessionImplementor
- Parameters:
name
- the name of a query defined in metadataresultClass
- the type of the query result- Returns:
- The Query instance for manipulation and execution
- See Also:
EntityManager.createNamedQuery(String,Class)
-
createNativeQuery
public NativeQueryImplementor createNativeQuery(java.lang.String sqlString)
Description copied from interface:QueryProducer
Create a NativeQuery instance for the given native (SQL) query- Specified by:
createNativeQuery
in interfaceEntityManager
- Specified by:
createNativeQuery
in interfaceQueryProducer
- Specified by:
createNativeQuery
in interfaceQueryProducerImplementor
- Specified by:
createNativeQuery
in interfaceSessionImplementor
- Parameters:
sqlString
- a native SQL query string- Returns:
- The NativeQuery instance for manipulation and execution
- See Also:
EntityManager.createNativeQuery(String)
-
createNativeQuery
public NativeQueryImplementor createNativeQuery(java.lang.String sqlString, java.lang.Class resultClass)
Description copied from interface:QueryProducer
Create a NativeQuery instance for the given native (SQL) query using implicit mapping to the specified Java type.- Specified by:
createNativeQuery
in interfaceEntityManager
- Specified by:
createNativeQuery
in interfaceQueryProducer
- Specified by:
createNativeQuery
in interfaceQueryProducerImplementor
- Specified by:
createNativeQuery
in interfaceSessionImplementor
- Parameters:
sqlString
- Native (SQL) query stringresultClass
- The Java type to map results to- Returns:
- The NativeQuery instance for manipulation and execution
- See Also:
EntityManager.createNativeQuery(String,Class)
-
createNativeQuery
public NativeQueryImplementor createNativeQuery(java.lang.String sqlString, java.lang.String resultSetMapping)
Description copied from interface:QueryProducer
Create a NativeQuery instance for the given native (SQL) query using implicit mapping to the specified Java type.- Specified by:
createNativeQuery
in interfaceEntityManager
- Specified by:
createNativeQuery
in interfaceQueryProducer
- Specified by:
createNativeQuery
in interfaceQueryProducerImplementor
- Specified by:
createNativeQuery
in interfaceSessionImplementor
- Parameters:
sqlString
- Native (SQL) query stringresultSetMapping
- The explicit (named) result mapping- Returns:
- The NativeQuery instance for manipulation and execution
- See Also:
EntityManager.createNativeQuery(String,Class)
,SqlResultSetMapping
-
createNamedStoredProcedureQuery
public StoredProcedureQuery createNamedStoredProcedureQuery(java.lang.String name)
- Specified by:
createNamedStoredProcedureQuery
in interfaceEntityManager
-
createStoredProcedureQuery
public StoredProcedureQuery createStoredProcedureQuery(java.lang.String procedureName)
- Specified by:
createStoredProcedureQuery
in interfaceEntityManager
-
createStoredProcedureQuery
public StoredProcedureQuery createStoredProcedureQuery(java.lang.String procedureName, java.lang.Class... resultClasses)
- Specified by:
createStoredProcedureQuery
in interfaceEntityManager
-
createStoredProcedureQuery
public StoredProcedureQuery createStoredProcedureQuery(java.lang.String procedureName, java.lang.String... resultSetMappings)
- Specified by:
createStoredProcedureQuery
in interfaceEntityManager
-
joinTransaction
public void joinTransaction()
- Specified by:
joinTransaction
in interfaceEntityManager
-
isJoinedToTransaction
public boolean isJoinedToTransaction()
- Specified by:
isJoinedToTransaction
in interfaceEntityManager
-
unwrap
public <T> T unwrap(java.lang.Class<T> cls)
- Specified by:
unwrap
in interfaceEntityManager
-
getDelegate
public java.lang.Object getDelegate()
This is an implementation of EntityManager#getDelegate(). It returns the current session and not the delegate session as it is what we want. The name of the method is misleading here but, as it is part of JPA, we cannot do anything about it.To get the underlying delegate, use
delegate()
instead.- Specified by:
getDelegate
in interfaceEntityManager
- See Also:
delegate()
-
createSQLQuery
public NativeQueryImplementor createSQLQuery(java.lang.String queryString)
Description copied from interface:QueryProducer
Create aNativeQuery
instance for the given SQL query string.- Specified by:
createSQLQuery
in interfaceQueryProducer
- Specified by:
createSQLQuery
in interfaceQueryProducerImplementor
- Specified by:
createSQLQuery
in interfaceSession
- Specified by:
createSQLQuery
in interfaceSessionImplementor
- Parameters:
queryString
- The SQL query- Returns:
- The query instance for manipulation and execution
-
getNamedProcedureCall
public ProcedureCall getNamedProcedureCall(java.lang.String name)
Description copied from interface:SharedSessionContract
Gets a ProcedureCall based on a named template- Specified by:
getNamedProcedureCall
in interfaceSharedSessionContract
- Parameters:
name
- The name given to the template- Returns:
- The ProcedureCall
- See Also:
NamedStoredProcedureQuery
-
createStoredProcedureCall
public ProcedureCall createStoredProcedureCall(java.lang.String procedureName)
Description copied from interface:SharedSessionContract
Creates a call to a stored procedure.- Specified by:
createStoredProcedureCall
in interfaceSharedSessionContract
- Parameters:
procedureName
- The name of the procedure.- Returns:
- The representation of the procedure call.
-
createStoredProcedureCall
public ProcedureCall createStoredProcedureCall(java.lang.String procedureName, java.lang.Class... resultClasses)
Description copied from interface:SharedSessionContract
Creates a call to a stored procedure with specific result set entity mappings. Each class named is considered a "root return".- Specified by:
createStoredProcedureCall
in 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(java.lang.String procedureName, java.lang.String... resultSetMappings)
Description copied from interface:SharedSessionContract
Creates a call to a stored procedure with specific result set entity mappings.- Specified by:
createStoredProcedureCall
in 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.
-
createCriteria
public Criteria createCriteria(java.lang.Class persistentClass)
Description copied from interface:SharedSessionContract
CreateCriteria
instance for the given class (entity or subclasses/implementors).- Specified by:
createCriteria
in interfaceSharedSessionContract
- Parameters:
persistentClass
- The class, which is an entity, or has entity subclasses/implementors- Returns:
- The criteria instance for manipulation and execution
-
createCriteria
public Criteria createCriteria(java.lang.Class persistentClass, java.lang.String alias)
Description copied from interface:SharedSessionContract
CreateCriteria
instance for the given class (entity or subclasses/implementors), using a specific alias.- Specified by:
createCriteria
in interfaceSharedSessionContract
- Parameters:
persistentClass
- The class, which is an entity, or has entity subclasses/implementorsalias
- The alias to use- Returns:
- The criteria instance for manipulation and execution
-
createCriteria
public Criteria createCriteria(java.lang.String entityName)
Description copied from interface:SharedSessionContract
CreateCriteria
instance for the given entity name.- Specified by:
createCriteria
in interfaceSharedSessionContract
- Parameters:
entityName
- The entity name- Returns:
- The criteria instance for manipulation and execution
-
createCriteria
public Criteria createCriteria(java.lang.String entityName, java.lang.String alias)
Description copied from interface:SharedSessionContract
CreateCriteria
instance for the given entity name, using a specific alias.- Specified by:
createCriteria
in interfaceSharedSessionContract
- Parameters:
entityName
- The entity namealias
- The alias to use- Returns:
- The criteria instance for manipulation and execution
-
sessionWithOptions
public SharedSessionBuilder sessionWithOptions()
Description copied from interface:Session
Obtain aSession
builder with the ability to grab certain information from this session.- Specified by:
sessionWithOptions
in interfaceSession
- Returns:
- The session builder
-
getSessionFactory
public SessionFactoryImplementor getSessionFactory()
Description copied from interface:Session
Get the session factory which created this session.- Specified by:
getSessionFactory
in interfaceSession
- Specified by:
getSessionFactory
in interfaceSessionImplementor
- Returns:
- The session factory.
- See Also:
SessionFactory
-
close
public void close() throws HibernateException
Description copied from interface:SharedSessionContract
End the session by releasing the JDBC connection and cleaning up.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceEntityManager
- Specified by:
close
in interfaceSharedSessionContract
- Throws:
HibernateException
- Indicates problems cleaning up.
-
cancelQuery
public void cancelQuery() throws HibernateException
Description copied from interface:Session
Cancel the execution of the current query. This is the sole method on session which may be safely called from another thread.- Specified by:
cancelQuery
in interfaceSession
- Throws:
HibernateException
- There was a problem canceling the query
-
isDirty
public boolean isDirty() throws HibernateException
Description copied from interface:Session
Does this session contain any changes which must be synchronized with the database? In other words, would any DML operations be executed if we flushed this session?- Specified by:
isDirty
in interfaceSession
- Returns:
- True if the session contains pending changes; false otherwise.
- Throws:
HibernateException
- could not perform dirtying checking
-
isDefaultReadOnly
public boolean isDefaultReadOnly()
Description copied from interface:Session
Will entities and proxies that are loaded into this session be made read-only by default? To determine the read-only/modifiable setting for a particular entity or proxy:- Specified by:
isDefaultReadOnly
in interfaceSession
- Returns:
- true, loaded entities/proxies will be made read-only by default; false, loaded entities/proxies will be made modifiable by default.
- See Also:
Session.isReadOnly(Object)
-
setDefaultReadOnly
public void setDefaultReadOnly(boolean readOnly)
Description copied from interface:Session
Change the default for entities and proxies loaded into this session from modifiable to read-only mode, or from modifiable to read-only mode. Read-only entities are not dirty-checked and snapshots of persistent state are not maintained. Read-only entities can be modified, but changes are not persisted. When a proxy is initialized, the loaded entity will have the same read-only/modifiable setting as the uninitialized proxy has, regardless of the session's current setting. To change the read-only/modifiable setting for a particular entity or proxy that is already in this session:- Specified by:
setDefaultReadOnly
in interfaceSession
- Parameters:
readOnly
- true, the default for loaded entities/proxies is read-only; false, the default for loaded entities/proxies is modifiable- See Also:
To override this session's read-only/modifiable setting for entities and proxies loaded by a Query:
,Query.setReadOnly(boolean)
-
getIdentifier
public java.io.Serializable getIdentifier(java.lang.Object object)
Description copied from interface:Session
Return the identifier value of the given entity as associated with this session. An exception is thrown if the given entity instance is transient or detached in relation to this session.- Specified by:
getIdentifier
in interfaceSession
- Parameters:
object
- a persistent instance- Returns:
- the identifier
-
contains
public boolean contains(java.lang.String entityName, java.lang.Object object)
Description copied from interface:Session
Check if this entity is associated with this Session. This form caters to non-POJO entities, by allowing the entity-name to be passed in
-
contains
public boolean contains(java.lang.Object object)
- Specified by:
contains
in interfaceEntityManager
-
getLockMode
public LockModeType getLockMode(java.lang.Object entity)
- Specified by:
getLockMode
in interfaceEntityManager
-
setProperty
public void setProperty(java.lang.String propertyName, java.lang.Object value)
- Specified by:
setProperty
in interfaceEntityManager
-
getProperties
public java.util.Map<java.lang.String,java.lang.Object> getProperties()
- Specified by:
getProperties
in interfaceEntityManager
-
evict
public void evict(java.lang.Object object)
Description copied from interface:Session
Remove this instance from the session cache. Changes to the instance will not be synchronized with the database. This operation cascades to associated instances if the association is mapped with cascade="evict".
-
load
public <T> T load(java.lang.Class<T> theClass, java.io.Serializable id, LockMode lockMode)
Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists. Convenient form ofSession.load(Class, Serializable, LockOptions)
- Specified by:
load
in interfaceSession
- Parameters:
theClass
- a persistent classid
- a valid identifier of an existing persistent instance of the classlockMode
- the lock level- Returns:
- the persistent instance or proxy
- See Also:
Session.load(Class, Serializable, LockOptions)
-
load
public <T> T load(java.lang.Class<T> theClass, java.io.Serializable id, LockOptions lockOptions)
Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.
-
load
public java.lang.Object load(java.lang.String entityName, java.io.Serializable id, LockMode lockMode)
Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists. Convenient form ofSession.load(String, Serializable, LockOptions)
- Specified by:
load
in interfaceSession
- Parameters:
entityName
- a persistent classid
- a valid identifier of an existing persistent instance of the classlockMode
- the lock level- Returns:
- the persistent instance or proxy
- See Also:
Session.load(String, Serializable, LockOptions)
-
load
public java.lang.Object load(java.lang.String entityName, java.io.Serializable id, LockOptions lockOptions)
Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.
-
load
public <T> T load(java.lang.Class<T> theClass, java.io.Serializable id)
Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists. This method might return a proxied instance that is initialized on-demand, when a non-identifier method is accessed.
You should not use this method to determine if an instance exists (use get() instead). Use this only to retrieve an instance that you assume exists, where non-existence would be an actual error.
-
load
public java.lang.Object load(java.lang.String entityName, java.io.Serializable id)
Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists. This method might return a proxied instance that is initialized on-demand, when a non-identifier method is accessed.
You should not use this method to determine if an instance exists (use get() instead). Use this only to retrieve an instance that you assume exists, where non-existence would be an actual error.
-
load
public void load(java.lang.Object object, java.io.Serializable id)
Description copied from interface:Session
Read the persistent state associated with the given identifier into the given transient instance.
-
replicate
public void replicate(java.lang.Object object, ReplicationMode replicationMode)
Description copied from interface:Session
Persist the state of the given detached instance, reusing the current identifier value. This operation cascades to associated instances if the association is mapped withcascade="replicate"
-
replicate
public void replicate(java.lang.String entityName, java.lang.Object object, ReplicationMode replicationMode)
Description copied from interface:Session
Persist the state of the given detached instance, reusing the current identifier value. This operation cascades to associated instances if the association is mapped withcascade="replicate"
-
save
public java.io.Serializable save(java.lang.Object object)
Description copied from interface:Session
Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the identifier property if the assigned generator is used.) This operation cascades to associated instances if the association is mapped withcascade="save-update"
-
save
public java.io.Serializable save(java.lang.String entityName, java.lang.Object object)
Description copied from interface:Session
Persist the given transient instance, first assigning a generated identifier. (Or using the current value of the identifier property if the assigned generator is used.) This operation cascades to associated instances if the association is mapped withcascade="save-update"
-
saveOrUpdate
public void saveOrUpdate(java.lang.Object object)
Description copied from interface:Session
EitherSession.save(Object)
orSession.update(Object)
the given instance, depending upon resolution of the unsaved-value checks (see the manual for discussion of unsaved-value checking). This operation cascades to associated instances if the association is mapped withcascade="save-update"
- Specified by:
saveOrUpdate
in interfaceSession
- Parameters:
object
- a transient or detached instance containing new or updated state- See Also:
Session.save(java.lang.Object)
,Session.update(Object object)
-
saveOrUpdate
public void saveOrUpdate(java.lang.String entityName, java.lang.Object object)
Description copied from interface:Session
EitherSession.save(String, Object)
orSession.update(String, Object)
the given instance, depending upon resolution of the unsaved-value checks (see the manual for discussion of unsaved-value checking). This operation cascades to associated instances if the association is mapped withcascade="save-update"
- Specified by:
saveOrUpdate
in interfaceSession
- Parameters:
entityName
- The entity nameobject
- a transient or detached instance containing new or updated state- See Also:
Session.save(String,Object)
,Session.update(String,Object)
-
update
public void update(java.lang.Object object)
Description copied from interface:Session
Update the persistent instance with the identifier of the given detached instance. If there is a persistent instance with the same identifier, an exception is thrown. This operation cascades to associated instances if the association is mapped withcascade="save-update"
-
update
public void update(java.lang.String entityName, java.lang.Object object)
Description copied from interface:Session
Update the persistent instance with the identifier of the given detached instance. If there is a persistent instance with the same identifier, an exception is thrown. This operation cascades to associated instances if the association is mapped withcascade="save-update"
-
merge
public java.lang.Object merge(java.lang.Object object)
Description copied from interface:Session
Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If the given instance is unsaved, save a copy of and return it as a newly persistent instance. The given instance does not become associated with the session. This operation cascades to associated instances if the association is mapped withcascade="merge"
The semantics of this method are defined by JSR-220.- Specified by:
merge
in interfaceEntityManager
- Specified by:
merge
in interfaceSession
- Parameters:
object
- a detached instance with state to be copied- Returns:
- an updated persistent instance
-
merge
public java.lang.Object merge(java.lang.String entityName, java.lang.Object object)
Description copied from interface:Session
Copy the state of the given object onto the persistent object with the same identifier. If there is no persistent instance currently associated with the session, it will be loaded. Return the persistent instance. If the given instance is unsaved, save a copy of and return it as a newly persistent instance. The given instance does not become associated with the session. This operation cascades to associated instances if the association is mapped withcascade="merge"
The semantics of this method are defined by JSR-220.
-
persist
public void persist(java.lang.Object object)
Description copied from interface:Session
Make a transient instance persistent. This operation cascades to associated instances if the association is mapped withcascade="persist"
The semantics of this method are defined by JSR-220.- Specified by:
persist
in interfaceEntityManager
- Specified by:
persist
in interfaceSession
- Parameters:
object
- a transient instance to be made persistent
-
remove
public void remove(java.lang.Object entity)
- Specified by:
remove
in interfaceEntityManager
-
find
public <T> T find(java.lang.Class<T> entityClass, java.lang.Object primaryKey)
- Specified by:
find
in interfaceEntityManager
-
find
public <T> T find(java.lang.Class<T> entityClass, java.lang.Object primaryKey, java.util.Map<java.lang.String,java.lang.Object> properties)
- Specified by:
find
in interfaceEntityManager
-
find
public <T> T find(java.lang.Class<T> entityClass, java.lang.Object primaryKey, LockModeType lockMode)
- Specified by:
find
in interfaceEntityManager
-
find
public <T> T find(java.lang.Class<T> entityClass, java.lang.Object primaryKey, LockModeType lockMode, java.util.Map<java.lang.String,java.lang.Object> properties)
- Specified by:
find
in interfaceEntityManager
-
getReference
public <T> T getReference(java.lang.Class<T> entityClass, java.lang.Object primaryKey)
- Specified by:
getReference
in interfaceEntityManager
-
persist
public void persist(java.lang.String entityName, java.lang.Object object)
Description copied from interface:Session
Make a transient instance persistent. This operation cascades to associated instances if the association is mapped withcascade="persist"
The semantics of this method are defined by JSR-220.
-
delete
public void delete(java.lang.Object object)
Description copied from interface:Session
Remove a persistent instance from the datastore. The argument may be an instance associated with the receiving Session or a transient instance with an identifier associated with existing persistent state. This operation cascades to associated instances if the association is mapped withcascade="delete"
-
delete
public void delete(java.lang.String entityName, java.lang.Object object)
Description copied from interface:Session
Remove a persistent instance from the datastore. The object argument may be an instance associated with the receiving Session or a transient instance with an identifier associated with existing persistent state. This operation cascades to associated instances if the association is mapped withcascade="delete"
-
lock
public void lock(java.lang.Object object, LockMode lockMode)
Description copied from interface:Session
Obtain the specified lock level upon the given object. This may be used to perform a version check (LockMode.READ), to upgrade to a pessimistic lock (LockMode.PESSIMISTIC_WRITE), or to simply reassociate a transient instance with a session (LockMode.NONE). This operation cascades to associated instances if the association is mapped with cascade="lock". Convenient form ofSession.LockRequest.lock(Object)
viaSession.buildLockRequest(LockOptions)
- Specified by:
lock
in interfaceSession
- Parameters:
object
- a persistent or transient instancelockMode
- the lock level- See Also:
Session.buildLockRequest(LockOptions)
,Session.LockRequest.lock(Object)
-
lock
public void lock(java.lang.String entityName, java.lang.Object object, LockMode lockMode)
Description copied from interface:Session
Obtain the specified lock level upon the given object. This may be used to perform a version check (LockMode.OPTIMISTIC), to upgrade to a pessimistic lock (LockMode.PESSIMISTIC_WRITE), or to simply reassociate a transient instance with a session (LockMode.NONE). This operation cascades to associated instances if the association is mapped with cascade="lock". Convenient form ofSession.LockRequest.lock(String, Object)
viaSession.buildLockRequest(LockOptions)
- Specified by:
lock
in interfaceSession
- Parameters:
entityName
- The name of the entityobject
- a persistent or transient instancelockMode
- the lock level- See Also:
Session.buildLockRequest(LockOptions)
,Session.LockRequest.lock(String, Object)
-
buildLockRequest
public Session.LockRequest buildLockRequest(LockOptions lockOptions)
Description copied from interface:Session
Build a LockRequest that specifies the LockMode, pessimistic lock timeout and lock scope. timeout and scope is ignored for optimistic locking. After building the LockRequest, call LockRequest.lock to perform the requested locking. Example usage:session.buildLockRequest().setLockMode(LockMode.PESSIMISTIC_WRITE).setTimeOut(60000).lock(entity);
- Specified by:
buildLockRequest
in interfaceSession
- Parameters:
lockOptions
- contains the lock level- Returns:
- a lockRequest that can be used to lock the passed object.
-
refresh
public void refresh(java.lang.Object object)
Description copied from interface:Session
Re-read the state of the given instance from the underlying database. It is inadvisable to use this to implement long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances. For example- where a database trigger alters the object state upon insert or update
- after executing direct SQL (eg. a mass update) in the same session
- after inserting a Blob or Clob
- Specified by:
refresh
in interfaceEntityManager
- Specified by:
refresh
in interfaceSession
- Parameters:
object
- a persistent or detached instance
-
refresh
public void refresh(java.lang.Object entity, java.util.Map<java.lang.String,java.lang.Object> properties)
- Specified by:
refresh
in interfaceEntityManager
-
refresh
public void refresh(java.lang.Object entity, LockModeType lockMode)
- Specified by:
refresh
in interfaceEntityManager
-
refresh
public void refresh(java.lang.Object entity, LockModeType lockMode, java.util.Map<java.lang.String,java.lang.Object> properties)
- Specified by:
refresh
in interfaceEntityManager
-
refresh
public void refresh(java.lang.String entityName, java.lang.Object object)
Description copied from interface:Session
Re-read the state of the given instance from the underlying database. It is inadvisable to use this to implement long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances. For example- where a database trigger alters the object state upon insert or update
- after executing direct SQL (eg. a mass update) in the same session
- after inserting a Blob or Clob
-
refresh
public void refresh(java.lang.Object object, LockMode lockMode)
Description copied from interface:Session
Re-read the state of the given instance from the underlying database, with the given LockMode. It is inadvisable to use this to implement long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances. Convenient form ofSession.refresh(Object, LockOptions)
- Specified by:
refresh
in interfaceSession
- Parameters:
object
- a persistent or detached instancelockMode
- the lock mode to use- See Also:
Session.refresh(Object, LockOptions)
-
refresh
public void refresh(java.lang.Object object, LockOptions lockOptions)
Description copied from interface:Session
Re-read the state of the given instance from the underlying database, with the given LockMode. It is inadvisable to use this to implement long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances.
-
refresh
public void refresh(java.lang.String entityName, java.lang.Object object, LockOptions lockOptions)
Description copied from interface:Session
Re-read the state of the given instance from the underlying database, with the given LockMode. It is inadvisable to use this to implement long-running sessions that span many business tasks. This method is, however, useful in certain special circumstances.
-
getCurrentLockMode
public LockMode getCurrentLockMode(java.lang.Object object)
Description copied from interface:Session
Determine the current lock mode of the given object.- Specified by:
getCurrentLockMode
in interfaceSession
- Parameters:
object
- a persistent instance- Returns:
- the current lock mode
-
createFilter
public Query createFilter(java.lang.Object collection, java.lang.String queryString)
Description copied from interface:Session
Create aQuery
instance for the given collection and filter string. Contains an implicitFROM
element namedthis
which refers to the defined table for the collection elements, as well as an implicitWHERE
restriction for this particular collection instance's key value.- Specified by:
createFilter
in interfaceSession
- Parameters:
collection
- a persistent collectionqueryString
- a Hibernate query fragment.- Returns:
- The query instance for manipulation and execution
-
clear
public void clear()
Description copied from interface:Session
Completely clear the session. Evict all loaded instances and cancel all pending saves, updates and deletions. Do not close open iterators or instances of ScrollableResults.- Specified by:
clear
in interfaceEntityManager
- Specified by:
clear
in interfaceSession
-
detach
public void detach(java.lang.Object entity)
- Specified by:
detach
in interfaceEntityManager
-
get
public <T> T get(java.lang.Class<T> theClass, java.io.Serializable id)
Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. (If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance.)
-
get
public <T> T get(java.lang.Class<T> theClass, java.io.Serializable id, LockMode lockMode)
Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. (If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance.) Obtain the specified lock mode if the instance exists. Convenient form ofSession.get(Class, Serializable, LockOptions)
- Specified by:
get
in interfaceSession
- Parameters:
theClass
- The entity typeid
- an identifierlockMode
- the lock mode- Returns:
- a persistent instance or null
- See Also:
Session.get(Class, Serializable, LockOptions)
-
get
public <T> T get(java.lang.Class<T> theClass, java.io.Serializable id, LockOptions lockOptions)
Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. (If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance.) Obtain the specified lock mode if the instance exists.
-
get
public java.lang.Object get(java.lang.String entityName, java.io.Serializable id)
Description copied from interface:Session
Return the persistent instance of the given named entity with the given identifier, or null if there is no such persistent instance. (If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance.)
-
get
public java.lang.Object get(java.lang.String entityName, java.io.Serializable id, LockMode lockMode)
Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. (If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance.) Obtain the specified lock mode if the instance exists. Convenient form ofSession.get(String, Serializable, LockOptions)
- Specified by:
get
in interfaceSession
- Parameters:
entityName
- the entity nameid
- an identifierlockMode
- the lock mode- Returns:
- a persistent instance or null
- See Also:
Session.get(String, Serializable, LockOptions)
-
get
public java.lang.Object get(java.lang.String entityName, java.io.Serializable id, LockOptions lockOptions)
Description copied from interface:Session
Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance. (If the instance is already associated with the session, return that instance. This method never returns an uninitialized instance.) Obtain the specified lock mode if the instance exists.
-
getEntityName
public java.lang.String getEntityName(java.lang.Object object)
Description copied from interface:Session
Return the entity name for a persistent entity.- Specified by:
getEntityName
in interfaceSession
- Parameters:
object
- a persistent entity- Returns:
- the entity name
-
byId
public IdentifierLoadAccess byId(java.lang.String entityName)
Description copied from interface:Session
Create anIdentifierLoadAccess
instance to retrieve the specified entity type by primary key.
-
byMultipleIds
public <T> MultiIdentifierLoadAccess<T> byMultipleIds(java.lang.Class<T> entityClass)
Description copied from interface:Session
Create aMultiIdentifierLoadAccess
instance to retrieve multiple entities at once as specified by primary key values.- Specified by:
byMultipleIds
in interfaceSession
- Parameters:
entityClass
- The entity type to be retrieved- Returns:
- load delegate for loading the specified entity type by primary key values
-
byMultipleIds
public MultiIdentifierLoadAccess byMultipleIds(java.lang.String entityName)
Description copied from interface:Session
Create aMultiIdentifierLoadAccess
instance to retrieve multiple entities at once as specified by primary key values.- Specified by:
byMultipleIds
in interfaceSession
- Parameters:
entityName
- The entity name of the entity type to be retrieved- Returns:
- load delegate for loading the specified entity type by primary key values
-
byId
public <T> IdentifierLoadAccess<T> byId(java.lang.Class<T> entityClass)
Description copied from interface:Session
Create anIdentifierLoadAccess
instance to retrieve the specified entity by primary key.
-
byNaturalId
public NaturalIdLoadAccess byNaturalId(java.lang.String entityName)
Description copied from interface:Session
Create aNaturalIdLoadAccess
instance to retrieve the specified entity by its natural id.- Specified by:
byNaturalId
in interfaceSession
- Parameters:
entityName
- The entity name of the entity type to be retrieved- Returns:
- load delegate for loading the specified entity type by natural id
-
byNaturalId
public <T> NaturalIdLoadAccess<T> byNaturalId(java.lang.Class<T> entityClass)
Description copied from interface:Session
Create aNaturalIdLoadAccess
instance to retrieve the specified entity by its natural id.- Specified by:
byNaturalId
in interfaceSession
- Parameters:
entityClass
- The entity type to be retrieved- Returns:
- load delegate for loading the specified entity type by natural id
-
bySimpleNaturalId
public SimpleNaturalIdLoadAccess bySimpleNaturalId(java.lang.String entityName)
Description copied from interface:Session
Create aSimpleNaturalIdLoadAccess
instance to retrieve the specified entity by its natural id.- Specified by:
bySimpleNaturalId
in interfaceSession
- Parameters:
entityName
- The entity name of the entity type to be retrieved- Returns:
- load delegate for loading the specified entity type by natural id
-
bySimpleNaturalId
public <T> SimpleNaturalIdLoadAccess<T> bySimpleNaturalId(java.lang.Class<T> entityClass)
Description copied from interface:Session
Create aSimpleNaturalIdLoadAccess
instance to retrieve the specified entity by its simple (single attribute) natural id.- Specified by:
bySimpleNaturalId
in interfaceSession
- Parameters:
entityClass
- The entity type to be retrieved- Returns:
- load delegate for loading the specified entity type by natural id
-
enableFilter
public Filter enableFilter(java.lang.String filterName)
Description copied from interface:Session
Enable the named filter for this current session.- Specified by:
enableFilter
in interfaceSession
- Parameters:
filterName
- The name of the filter to be enabled.- Returns:
- The Filter instance representing the enabled filter.
-
getEnabledFilter
public Filter getEnabledFilter(java.lang.String filterName)
Description copied from interface:Session
Retrieve a currently enabled filter by name.- Specified by:
getEnabledFilter
in interfaceSession
- Parameters:
filterName
- The name of the filter to be retrieved.- Returns:
- The Filter instance representing the enabled filter.
-
disableFilter
public void disableFilter(java.lang.String filterName)
Description copied from interface:Session
Disable the named filter for the current session.- Specified by:
disableFilter
in interfaceSession
- Parameters:
filterName
- The name of the filter to be disabled.
-
getStatistics
public SessionStatistics getStatistics()
Description copied from interface:Session
Get the statistics for this session.- Specified by:
getStatistics
in interfaceSession
- Returns:
- The session statistics being collected for this session
-
isReadOnly
public boolean isReadOnly(java.lang.Object entityOrProxy)
Description copied from interface:Session
Is the specified entity or proxy read-only? To get the default read-only/modifiable setting used for entities and proxies that are loaded into the session:- Specified by:
isReadOnly
in interfaceSession
- Parameters:
entityOrProxy
- an entity or HibernateProxy- Returns:
true
if the entity or proxy is read-only,false
if the entity or proxy is modifiable.- See Also:
Session.isDefaultReadOnly()
-
setReadOnly
public void setReadOnly(java.lang.Object entityOrProxy, boolean readOnly)
Description copied from interface:Session
Set an unmodified persistent object to read-only mode, or a read-only object to modifiable mode. In read-only mode, no snapshot is maintained, the instance is never dirty checked, and changes are not persisted. If the entity or proxy already has the specified read-only/modifiable setting, then this method does nothing. To set the default read-only/modifiable setting used for entities and proxies that are loaded into the session:- Specified by:
setReadOnly
in interfaceSession
- Parameters:
entityOrProxy
- an entity or HibernateProxyreadOnly
-true
if the entity or proxy should be made read-only;false
if the entity or proxy should be made modifiable- See Also:
To override this session's read-only/modifiable setting for entities and proxies loaded by a Query:
,Query.setReadOnly(boolean)
-
doWork
public void doWork(Work work) throws HibernateException
Description copied from interface:Session
Controller for allowing users to perform JDBC related work using the Connection managed by this Session.- Specified by:
doWork
in interfaceSession
- 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:Session
Controller for allowing users to perform JDBC related work using the Connection managed by this Session. After execution returns the result of theReturningWork.execute(java.sql.Connection)
call.- Specified by:
doReturningWork
in interfaceSession
- Type Parameters:
T
- The type of the result returned from the work- Parameters:
work
- The work to be performed.- Returns:
- the result from calling
ReturningWork.execute(java.sql.Connection)
. - Throws:
HibernateException
- Generally indicates wrappedSQLException
-
disconnect
public java.sql.Connection disconnect()
Description copied from interface:Session
Disconnect the session from its underlying JDBC connection. This is intended for use in cases where the application has supplied the JDBC connection to the session and which require long-sessions (aka, conversations). It is considered an error to call this method on a session which was not opened by supplying the JDBC connection and an exception will be thrown. For non-user-supplied scenarios, normal transaction management already handles disconnection and reconnection automatically.- Specified by:
disconnect
in interfaceSession
- Returns:
- the application-supplied connection or
null
- See Also:
Session.reconnect(Connection)
-
reconnect
public void reconnect(java.sql.Connection connection)
Description copied from interface:Session
Reconnect to the given JDBC connection.- Specified by:
reconnect
in interfaceSession
- Parameters:
connection
- a JDBC connection- See Also:
Session.disconnect()
-
isFetchProfileEnabled
public boolean isFetchProfileEnabled(java.lang.String name) throws UnknownProfileException
Description copied from interface:Session
Is a particular fetch profile enabled on this session?- Specified by:
isFetchProfileEnabled
in interfaceSession
- Parameters:
name
- The name of the profile to be checked.- Returns:
- True if fetch profile is enabled; false if not.
- Throws:
UnknownProfileException
- Indicates that the given name does not match any known profile names- See Also:
for discussion of this feature
-
enableFetchProfile
public void enableFetchProfile(java.lang.String name) throws UnknownProfileException
Description copied from interface:Session
Enable a particular fetch profile on this session. No-op if requested profile is already enabled.- Specified by:
enableFetchProfile
in interfaceSession
- Parameters:
name
- The name of the fetch profile to be enabled.- Throws:
UnknownProfileException
- Indicates that the given name does not match any known profile names- See Also:
for discussion of this feature
-
disableFetchProfile
public void disableFetchProfile(java.lang.String name) throws UnknownProfileException
Description copied from interface:Session
Disable a particular fetch profile on this session. No-op if requested profile is already disabled.- Specified by:
disableFetchProfile
in interfaceSession
- Parameters:
name
- The name of the fetch profile to be disabled.- Throws:
UnknownProfileException
- Indicates that the given name does not match any known profile names- See Also:
for discussion of this feature
-
getTypeHelper
public TypeHelper getTypeHelper()
Description copied from interface:Session
Convenience access to theTypeHelper
associated with this session'sSessionFactory
. Equivalent to callingSession.getSessionFactory()
.getTypeHelper()
- Specified by:
getTypeHelper
in interfaceSession
- Returns:
- The
TypeHelper
associated with this session'sSessionFactory
-
getLobHelper
public LobHelper getLobHelper()
Description copied from interface:Session
Retrieve this session's helper/delegate for creating LOB instances.- Specified by:
getLobHelper
in interfaceSession
- Returns:
- This session's LOB helper
-
addEventListeners
public void addEventListeners(SessionEventListener... listeners)
Description copied from interface:Session
Add one or more listeners to the Session- Specified by:
addEventListeners
in interfaceSession
- Parameters:
listeners
- The listener(s) to add
-
isFlushBeforeCompletionEnabled
public boolean isFlushBeforeCompletionEnabled()
- Specified by:
isFlushBeforeCompletionEnabled
in interfaceSessionImplementor
-
getActionQueue
public ActionQueue getActionQueue()
- Specified by:
getActionQueue
in interfaceSessionImplementor
-
instantiate
public java.lang.Object instantiate(EntityPersister persister, java.io.Serializable id) throws HibernateException
- Specified by:
instantiate
in interfaceSessionImplementor
- Throws:
HibernateException
-
forceFlush
public void forceFlush(EntityEntry e) throws HibernateException
- Specified by:
forceFlush
in interfaceSessionImplementor
- Throws:
HibernateException
-
merge
public void merge(java.lang.String entityName, java.lang.Object object, java.util.Map copiedAlready) throws HibernateException
- Specified by:
merge
in interfaceSessionImplementor
- Throws:
HibernateException
-
persist
public void persist(java.lang.String entityName, java.lang.Object object, java.util.Map createdAlready) throws HibernateException
- Specified by:
persist
in interfaceSessionImplementor
- Throws:
HibernateException
-
persistOnFlush
public void persistOnFlush(java.lang.String entityName, java.lang.Object object, java.util.Map copiedAlready)
- Specified by:
persistOnFlush
in interfaceSessionImplementor
-
refresh
public void refresh(java.lang.String entityName, java.lang.Object object, java.util.Map refreshedAlready) throws HibernateException
- Specified by:
refresh
in interfaceSessionImplementor
- Throws:
HibernateException
-
delete
public void delete(java.lang.String entityName, java.lang.Object child, boolean isCascadeDeleteEnabled, java.util.Set transientEntities)
- Specified by:
delete
in interfaceSessionImplementor
-
removeOrphanBeforeUpdates
public void removeOrphanBeforeUpdates(java.lang.String entityName, java.lang.Object child)
- Specified by:
removeOrphanBeforeUpdates
in interfaceSessionImplementor
-
getSession
public SessionImplementor getSession()
Description copied from interface:HibernateEntityManager
Retrieve a reference to the HibernateSession
used by thisEntityManager
.- Specified by:
getSession
in interfaceHibernateEntityManager
- Specified by:
getSession
in interfaceHibernateEntityManagerImplementor
- Returns:
- The session
-
useStreamForLobBinding
public boolean useStreamForLobBinding()
Description copied from interface:WrapperOptions
Should streams be used for binding LOB values.- Specified by:
useStreamForLobBinding
in interfaceWrapperOptions
- Returns:
true
/false
-
getLobCreator
public LobCreator getLobCreator()
Description copied from interface:WrapperOptions
Obtain access to theLobCreator
- Specified by:
getLobCreator
in interfaceWrapperOptions
- Returns:
- The LOB creator
-
remapSqlTypeDescriptor
public SqlTypeDescriptor remapSqlTypeDescriptor(SqlTypeDescriptor sqlTypeDescriptor)
Description copied from interface:WrapperOptions
Allow remapping of descriptors for dealing with sql type.- Specified by:
remapSqlTypeDescriptor
in interfaceWrapperOptions
- Parameters:
sqlTypeDescriptor
- The known descriptor- Returns:
- The remapped descriptor. May be the same as the known descriptor indicating no remapping.
-
getJdbcBatchSize
public java.lang.Integer getJdbcBatchSize()
Description copied from interface:SharedSessionContract
Get the Session-level JDBC batch size for the current Session. Overrides the SessionFactory JDBC batch size defined by thehibernate.default_batch_fetch_size
configuration property for the scope of the currentSession
.- Specified by:
getJdbcBatchSize
in interfaceJdbcSessionOwner
- Specified by:
getJdbcBatchSize
in interfaceSharedSessionContract
- Returns:
- Session-level JDBC batch size
- See Also:
SessionFactoryOptions.getJdbcBatchSize()
,SessionFactoryBuilder.applyJdbcBatchSize(int)
-
setJdbcBatchSize
public void setJdbcBatchSize(java.lang.Integer jdbcBatchSize)
Description copied from interface:SharedSessionContract
Set the Session-level JDBC batch size. Overrides the SessionFactory JDBC batch size defined by thehibernate.default_batch_fetch_size
configuration property for the scope of the currentSession
.- Specified by:
setJdbcBatchSize
in interfaceSharedSessionContract
- Parameters:
jdbcBatchSize
- Session-level JDBC batch size- See Also:
SessionFactoryOptions.getJdbcBatchSize()
,SessionFactoryBuilder.applyJdbcBatchSize(int)
-
getJdbcTimeZone
public java.util.TimeZone getJdbcTimeZone()
Description copied from interface:WrapperOptions
The JDBCTimeZone
used when persisting Timestamp and DateTime properties into the database. This setting is used when storing timestamps using thePreparedStatement.setTimestamp(int, Timestamp, Calendar)
method. This way, the storageTimeZone
can differ from the default JVM TimeZone given byTimeZone.getDefault()
.- Specified by:
getJdbcTimeZone
in interfaceWrapperOptions
- Returns:
- JDBC
TimeZone
-
-