Top Description Fields Constructors Methods
org.hibernate.engine.spi

public Class SessionLazyDelegator

extends Object
implements Session
Class Inheritance
All Implemented Interfaces
org.hibernate.Session, jakarta.persistence.EntityManager, java.lang.AutoCloseable, org.hibernate.SharedSessionContract, java.io.Serializable, java.io.Closeable, org.hibernate.query.QueryProducer
Imports
java.util.List, .Map, java.util.function.Supplier, jakarta.persistence.CacheRetrieveMode, .CacheStoreMode, .EntityGraph, .EntityManagerFactory, .FlushModeType, .LockModeType, org.hibernate.CacheMode, .Filter, .FlushMode, .HibernateException, .IdentifierLoadAccess, .LobHelper, .LockMode, .LockOptions, .MultiIdentifierLoadAccess, .NaturalIdLoadAccess, .NaturalIdMultiLoadAccess, .ReplicationMode, .Session, .SessionEventListener, .SessionFactory, .SharedSessionBuilder, .SimpleNaturalIdLoadAccess, .Transaction, .UnknownProfileException, org.hibernate.graph.RootGraph, org.hibernate.jdbc.ReturningWork, .Work, org.hibernate.procedure.ProcedureCall, org.hibernate.query.MutationQuery, .NativeQuery, .Query, .SelectionQuery, org.hibernate.query.criteria.HibernateCriteriaBuilder, .JpaCriteriaInsertSelect, org.hibernate.stat.SessionStatistics, jakarta.persistence.criteria.CriteriaDelete, .CriteriaQuery, .CriteriaUpdate, jakarta.persistence.metamodel.Metamodel, org.checkerframework.checker.nullness.qual.Nullable

This helper class allows decorating a Session instance, while the instance itself is lazily provided via a Supplier. When the decorated instance is readily available, one should prefer using SessionDelegatorBaseImpl.

Another difference with SessionDelegatorBaseImpl is that this type only implements Session.

Author
Sanne Grinovero

Field Summary

Modifier and TypeField and Description
private final Supplier<Session>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
addEventListeners(SessionEventListener...
the listener(s) to add
listeners
)

Implements org.hibernate.Session.addEventListeners.

Add one or more listeners to the Session
public Transaction
beginTransaction()

Implements org.hibernate.SharedSessionContract.beginTransaction.

Begin a unit of work and return the associated Transaction object.
public Session.LockRequest
buildLockRequest(LockOptions
contains the lock level
lockOptions
)

Implements org.hibernate.Session.buildLockRequest.

Deprecated
Build a new lock request that specifies:
public <T> IdentifierLoadAccess<T>
byId(String
the entity name of the entity type to be retrieved
entityName
)

Implements org.hibernate.Session.byId.

Create an IdentifierLoadAccess instance to retrieve an instance of the named entity type by its primary key.
public <T> IdentifierLoadAccess<T>
byId(Class<T>
the entity type to be retrieved
entityClass
)

Implements org.hibernate.Session.byId.

Create an IdentifierLoadAccess instance to retrieve an instance of the given entity type by its primary key.
public <T> MultiIdentifierLoadAccess<T>
byMultipleIds(Class<T>
the entity type to be retrieved
entityClass
)

Implements org.hibernate.Session.byMultipleIds.

Create a MultiIdentifierLoadAccess instance to retrieve multiple instances of the given entity type by their primary key values, using batching.
public <T> MultiIdentifierLoadAccess<T>
byMultipleIds(String
the entity name of the entity type to be retrieved
entityName
)

Implements org.hibernate.Session.byMultipleIds.

Create a MultiIdentifierLoadAccess instance to retrieve multiple instances of the named entity type by their primary key values, using batching.
public <T> NaturalIdMultiLoadAccess<T>
byMultipleNaturalId(Class<T>
the entity type to be retrieved
entityClass
)

Implements org.hibernate.Session.byMultipleNaturalId.

Create a MultiIdentifierLoadAccess instance to retrieve multiple instances of the given entity type by their by natural id values, using batching.
public <T> NaturalIdMultiLoadAccess<T>
byMultipleNaturalId(String
the entity name of the entity type to be retrieved
entityName
)

Implements org.hibernate.Session.byMultipleNaturalId.

Create a MultiIdentifierLoadAccess instance to retrieve multiple instances of the named entity type by their by natural id values, using batching.
public <T> NaturalIdLoadAccess<T>
byNaturalId(String
the entity name of the entity type to be retrieved
entityName
)

Implements org.hibernate.Session.byNaturalId.

Create a NaturalIdLoadAccess instance to retrieve an instance of the named entity type by its natural id, which may be a composite natural id. The entity must have at least one attribute annotated org.hibernate.annotations.NaturalId.
public <T> NaturalIdLoadAccess<T>
byNaturalId(Class<T>
the entity type to be retrieved
entityClass
)

Implements org.hibernate.Session.byNaturalId.

Create a NaturalIdLoadAccess instance to retrieve an instance of the given entity type by its natural id, which may be a composite natural id. The entity must have at least one attribute annotated org.hibernate.annotations.NaturalId.
public <T> SimpleNaturalIdLoadAccess<T>
bySimpleNaturalId(String
the entity name of the entity type to be retrieved
entityName
)

Implements org.hibernate.Session.bySimpleNaturalId.

Create a SimpleNaturalIdLoadAccess instance to retrieve an instance of the named entity type by its natural id, which must be a simple (non-composite) value.
public <T> SimpleNaturalIdLoadAccess<T>
bySimpleNaturalId(Class<T>
the entity type to be retrieved
entityClass
)

Implements org.hibernate.Session.bySimpleNaturalId.

Create a SimpleNaturalIdLoadAccess instance to retrieve an instance of the given entity type by its natural id, which must be a simple (non-composite) value.
public void
cancelQuery()

Implements org.hibernate.Session.cancelQuery.

Cancel the execution of the current query.
public void
clear()

Implements org.hibernate.Session.clear.

Completely clear the session.
public void
close()

Implements org.hibernate.SharedSessionContract.close, jakarta.persistence.EntityManager.close.

End the session by releasing the JDBC connection and cleaning up.
public boolean
contains(String
the entity name
entityName
,
Object
an instance of a persistent class
object
)

Implements org.hibernate.Session.contains.

Determine if the given entity is associated with this session.
public boolean
contains(Object
entity instance
entity
)

Implements jakarta.persistence.EntityManager.contains.

Check if the instance is a managed entity instance belonging to the current persistence context.
public <T> RootGraph<T>
createEntityGraph(Class<T>
the root entity class of the graph
rootType
)

Implements org.hibernate.Session.createEntityGraph.

Create a new mutable EntityGraph with only a root node.
public RootGraph<?>
createEntityGraph(String
the name of the graph
graphName
)

Implements org.hibernate.Session.createEntityGraph.

Create a new mutable copy of the named EntityGraph, or return null if there is no graph with the given name.
public <T> RootGraph<T>
createEntityGraph(Class<T>
the root entity class of the graph
rootType
,
String
the name of the graph
graphName
)

Implements org.hibernate.SharedSessionContract.createEntityGraph.

Create a new mutable copy of the named EntityGraph, or return null if there is no graph with the given name.
public MutationQuery
createMutationQuery(String hqlString)

Implements org.hibernate.query.QueryProducer.createMutationQuery.

Create a MutationQuery reference for the given HQL insert, update, or delete statement.
public MutationQuery
createMutationQuery(CriteriaUpdate<T> updateQuery)

Implements org.hibernate.query.QueryProducer.createMutationQuery.

Create a MutationQuery from the given update criteria tree
public MutationQuery
createMutationQuery(CriteriaDelete<T> deleteQuery)

Implements org.hibernate.query.QueryProducer.createMutationQuery.

Create a MutationQuery from the given delete criteria tree
public MutationQuery
createMutationQuery(JpaCriteriaInsertSelect<T> insertSelect)

Implements org.hibernate.query.QueryProducer.createMutationQuery.

Create a MutationQuery from the given insert-select criteria tree
public MutationQuery
createNamedMutationQuery(String name)

Implements org.hibernate.query.QueryProducer.createNamedMutationQuery.

Create a MutationQuery instance for the given named insert, update, or delete HQL query.
public <R> Query<R>
createNamedQuery(String
the name of a query defined in metadata
name
,
Class<R>
the type of the query result
resultClass
)

Implements org.hibernate.Session.createNamedQuery.

Create an instance of TypedQuery for executing a Jakarta Persistence query language named query.
public Query<R>
createNamedQuery(String
the name of a query defined in metadata
name
)

Implements org.hibernate.Session.createNamedQuery.

Deprecated
Create an instance of Query for executing a named query (in the Jakarta Persistence query language or in native SQL).
public SelectionQuery<?>
public <R> SelectionQuery<R>
createNamedSelectionQuery(String name, Class<R> resultType)

Implements org.hibernate.query.QueryProducer.createNamedSelectionQuery.

Create a SelectionQuery instance for the named jakarta.persistence.NamedQuery with the given result type.
public ProcedureCall
public MutationQuery
createNativeMutationQuery(String
a native SQL statement string
sqlString
)

Implements org.hibernate.query.QueryProducer.createNativeMutationQuery.

Create a NativeQuery instance for the given native SQL statement.
public NativeQuery<T>
createNativeQuery(String
a native SQL query string
sqlString
)

Implements org.hibernate.query.QueryProducer.createNativeQuery, jakarta.persistence.EntityManager.createNativeQuery.

Deprecated
Create an instance of Query for executing a native SQL statement, e.g., for update or delete.
public NativeQuery<T>
createNativeQuery(String
a native SQL query string
sqlString
,
Class<T>
the class of the resulting instance(s)
resultClass
)

Implements org.hibernate.query.QueryProducer.createNativeQuery, jakarta.persistence.EntityManager.createNativeQuery.

Create an instance of Query for executing a native SQL query.
public <R> NativeQuery<R>
createNativeQuery(String
Native (SQL) query string
sqlString
,
Class<R>
The Java entity class to map results to
resultClass
,
String
The table alias for columns in the result set
tableAlias
)

Implements org.hibernate.query.QueryProducer.createNativeQuery.

Create a NativeQuery instance for the given native SQL query using an implicit mapping to the specified Java entity type.
public NativeQuery<T>
createNativeQuery(String
a native SQL query string
sqlString
,
String
the name of the result set mapping
resultSetMappingName
)

Implements org.hibernate.query.QueryProducer.createNativeQuery, jakarta.persistence.EntityManager.createNativeQuery.

Deprecated
Create an instance of Query for executing a native SQL query.
public <R> NativeQuery<R>
createNativeQuery(String
The native (SQL) query string
sqlString
,
String
The explicit result mapping name
resultSetMappingName
,
Class<R> resultClass)

Implements org.hibernate.query.QueryProducer.createNativeQuery.

Create a NativeQuery instance for the given native SQL query using an explicit mapping to the specified Java type.
public <R> Query<R>
createQuery(String
a Jakarta Persistence query string
queryString
,
Class<R>
the type of the query result
resultClass
)

Implements org.hibernate.Session.createQuery.

Create an instance of TypedQuery for executing a Jakarta Persistence query language statement.
public Query<R>
createQuery(String
a Jakarta Persistence query string
queryString
)

Implements org.hibernate.Session.createQuery.

Deprecated
Create an instance of Query for executing a Jakarta Persistence query language statement.
public <R> Query<R>
createQuery(CriteriaQuery<R>
a criteria query object
criteriaQuery
)

Implements org.hibernate.Session.createQuery.

Create an instance of TypedQuery for executing a criteria query.
public Query<R>
createQuery(CriteriaDelete<T>
a criteria delete query object
deleteQuery
)

Implements org.hibernate.Session.createQuery.

Deprecated
Create a Query for the given JPA CriteriaDelete.
public Query<R>
createQuery(CriteriaUpdate<T>
a criteria update query object
updateQuery
)

Implements org.hibernate.Session.createQuery.

Deprecated
Create a Query for the given JPA CriteriaUpdate.
public SelectionQuery<?>
createSelectionQuery(String hqlString)

Implements org.hibernate.query.QueryProducer.createSelectionQuery.

Create a SelectionQuery reference for the given HQL select statement.
public <R> SelectionQuery<R>
createSelectionQuery(String
The HQL query as a string
hqlString
,
Class<R>
The Class object representing the query result type
resultType
)

Implements org.hibernate.query.QueryProducer.createSelectionQuery.

Create a SelectionQuery instance for the given HQL query string and given query result type.
public <R> SelectionQuery<R>
public ProcedureCall
createStoredProcedureCall(String
The name of the procedure.
procedureName
)

Implements org.hibernate.SharedSessionContract.createStoredProcedureCall.

Create a ProcedureCall to a stored procedure.
public ProcedureCall
createStoredProcedureCall(String
The name of the procedure.
procedureName
,
Class<?>...
The entity(s) to map the result on to.
resultClasses
)

Implements org.hibernate.SharedSessionContract.createStoredProcedureCall.

Create a ProcedureCall to a stored procedure with the given result set entity mappings.
public ProcedureCall
createStoredProcedureCall(String
The name of the procedure.
procedureName
,
String...
The explicit result set mapping(s) to use for mapping the results
resultSetMappings
)

Implements org.hibernate.SharedSessionContract.createStoredProcedureCall.

Create a ProcedureCall to a stored procedure with the given result set entity mappings.
public ProcedureCall
public ProcedureCall
createStoredProcedureQuery(String
The name of the procedure.
procedureName
,
Class<T>...
The entity(s) to map the result on to.
resultClasses
)

Implements org.hibernate.SharedSessionContract.createStoredProcedureQuery, jakarta.persistence.EntityManager.createStoredProcedureQuery.

Create a ProcedureCall to a stored procedure with the given result set entity mappings.
public ProcedureCall
createStoredProcedureQuery(String
The name of the procedure.
procedureName
,
String...
The explicit result set mapping(s) to use for mapping the results
resultSetMappings
)

Implements org.hibernate.SharedSessionContract.createStoredProcedureQuery, jakarta.persistence.EntityManager.createStoredProcedureQuery.

Create a ProcedureCall to a stored procedure with the given result set entity mappings.
public void
delete(Object
the instance to be removed
object
)

Implements org.hibernate.Session.delete.

Deprecated
Remove a persistent instance from the datastore.
public void
delete(String
the entity name for the instance to be removed.
entityName
,
Object
the instance to be removed
object
)

Implements org.hibernate.Session.delete.

Deprecated
Remove a persistent instance from the datastore.
public void
detach(Object
the managed instance to detach
object
)

Implements org.hibernate.Session.detach.

Remove this instance from the session cache.
public void
disableFetchProfile(String
the name of the fetch profile to be disabled
name
)

Implements org.hibernate.Session.disableFetchProfile.

Disable the fetch profile with the given name in this session.
public void
disableFilter(String
the name of the filter to be disabled.
filterName
)

Implements org.hibernate.Session.disableFilter.

Disable the named filter for the current session.
public <T> T
doReturningWork(ReturningWork<T>
The work to be performed.
work
)

Overrides default org.hibernate.SharedSessionContract.doReturningWork.

Perform work using the java.sql.Connection underlying by this session, and return a result.
public void
doWork(Work
The work to be performed.
work
)

Overrides default org.hibernate.SharedSessionContract.doWork.

Perform work using the java.sql.Connection underlying by this session.
public void
enableFetchProfile(String
the name of the fetch profile to be enabled
name
)

Implements org.hibernate.Session.enableFetchProfile.

Enable the fetch profile with the given name in this session.
public Filter
enableFilter(String
the name of the filter to be enabled.
filterName
)

Implements org.hibernate.Session.enableFilter.

Enable the named filter for this current session.
public void
evict(Object
the managed entity to evict
object
)

Implements org.hibernate.Session.evict.

Remove this instance from the session cache.
public <T> @Nullable T
find(Class<T>
entity class
entityClass
,
Object
primary key
primaryKey
)

Implements jakarta.persistence.EntityManager.find.

Find by primary key.
public <T> @Nullable T
find(Class<T>
entity class
entityClass
,
Object
primary key
primaryKey
,
Map<String, Object>
standard and vendor-specific properties and hints
properties
)

Implements jakarta.persistence.EntityManager.find.

Find by primary key, using the specified properties.
public <T> @Nullable T
find(Class<T>
entity class
entityClass
,
Object
primary key
primaryKey
,
LockModeType
lock mode
lockMode
)

Implements jakarta.persistence.EntityManager.find.

Find by primary key and lock.
public <T> @Nullable T
find(Class<T>
entity class
entityClass
,
Object
primary key
primaryKey
,
LockModeType
lock mode
lockMode
,
Map<String, Object>
standard and vendor-specific properties and hints
properties
)

Implements jakarta.persistence.EntityManager.find.

Find by primary key and lock, using the specified properties.
public void
flush()

Implements org.hibernate.Session.flush.

Force this session to flush.
public <T> T
get(Class<T>
the entity type
entityType
,
Object
an identifier
id
)

Implements org.hibernate.Session.get.

Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.
public <T> T
get(Class<T>
the entity type
entityType
,
Object
an identifier
id
,
LockMode
the lock mode
lockMode
)

Implements org.hibernate.Session.get.

Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.
public <T> T
get(Class<T>
the entity type
entityType
,
Object
an identifier
id
,
LockOptions
the lock mode
lockOptions
)

Implements org.hibernate.Session.get.

Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.
public Object
get(String
the entity name
entityName
,
Object
an identifier
id
)

Implements org.hibernate.Session.get.

Return the persistent instance of the given named entity with the given identifier, or null if there is no such persistent instance.
public Object
get(String
the entity name
entityName
,
Object
an identifier
id
,
LockMode
the lock mode
lockMode
)

Implements org.hibernate.Session.get.

Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.
public Object
get(String
the entity name
entityName
,
Object
an identifier
id
,
LockOptions
contains the lock mode
lockOptions
)

Implements org.hibernate.Session.get.

Return the persistent instance of the given entity class with the given identifier, or null if there is no such persistent instance.
public CacheMode
getCacheMode()

Implements org.hibernate.Session.getCacheMode.

Get the current cache mode for this session.
public CacheRetrieveMode
public CacheStoreMode
public HibernateCriteriaBuilder
public LockMode
getCurrentLockMode(Object
a persistent instance
object
)

Implements org.hibernate.Session.getCurrentLockMode.

Determine the current LockMode of the given managed instance associated with this session.
public Object
getDelegate()

Implements jakarta.persistence.EntityManager.getDelegate.

Return the underlying provider object for the EntityManager, if available.
public Filter
getEnabledFilter(String
the name of the filter to be retrieved.
filterName
)

Implements org.hibernate.Session.getEnabledFilter.

Retrieve a currently enabled filter by name.
public RootGraph<?>
getEntityGraph(String
the name of the graph
graphName
)

Implements org.hibernate.Session.getEntityGraph.

Retrieve the named EntityGraph as an immutable graph, or return null if there is no graph with the given name.
public <T> List<EntityGraph<? super T>>
getEntityGraphs(Class<T>
entity class
entityClass
)

Implements org.hibernate.Session.getEntityGraphs.

Retrieve all named EntityGraphs with the given type.
public EntityManagerFactory
getEntityManagerFactory()

Implements jakarta.persistence.EntityManager.getEntityManagerFactory.

Return the entity manager factory for the entity manager.
public String
getEntityName(Object
a persistent entity associated with this session
object
)

Implements org.hibernate.Session.getEntityName.

Return the entity name for a persistent entity.
public SessionFactory
getFactory()

Implements org.hibernate.SharedSessionContract.getFactory.

The factory which created this session.
public int
getFetchBatchSize()

Implements org.hibernate.Session.getFetchBatchSize.

Get the maximum batch size for batch fetching associations by id in this session.
public FlushModeType
getFlushMode()

Implements org.hibernate.Session.getFlushMode.

Get the current JPA flush mode for this session.
public FlushMode
getHibernateFlushMode()

Implements org.hibernate.Session.getHibernateFlushMode.

Get the current flush mode for this session.
public Object
getIdentifier(Object
a persistent instance associated with this session
object
)

Implements org.hibernate.Session.getIdentifier.

Return the identifier value of the given entity associated with this session.
public Integer
getJdbcBatchSize()

Implements org.hibernate.SharedSessionContract.getJdbcBatchSize.

Get the session-level JDBC batch size for the current session.
public LobHelper
public LockModeType
getLockMode(Object
entity instance
entity
)

Implements jakarta.persistence.EntityManager.getLockMode.

Get the current lock mode for the entity instance.
public Metamodel
getMetamodel()

Implements jakarta.persistence.EntityManager.getMetamodel.

Return an instance of Metamodel interface for access to the metamodel of the persistence unit.
public NativeQuery<T>
getNamedNativeQuery(String
The name of the predefined query
name
)

Implements org.hibernate.query.QueryProducer.getNamedNativeQuery.

Deprecated
Get a NativeQuery instance for a named native SQL query
public NativeQuery<T>
getNamedNativeQuery(String
The name of the predefined query
name
,
String resultSetMapping)

Implements org.hibernate.query.QueryProducer.getNamedNativeQuery.

Deprecated
Get a NativeQuery instance for a named native SQL query
public ProcedureCall
getNamedProcedureCall(String
The name given to the template
name
)

Implements org.hibernate.SharedSessionContract.getNamedProcedureCall.

Obtain a ProcedureCall based on a named template
public Query<R>
getNamedQuery(String
the name of a predefined named query
queryName
)

Implements org.hibernate.query.QueryProducer.getNamedQuery.

Deprecated
Create a Query instance for the named query.
public Map<String, Object>
getProperties()

Implements jakarta.persistence.EntityManager.getProperties.

Get the properties and hints and associated values that are in effect for the entity manager.
public <T> T
getReference(Class<T>
the entity type
entityType
,
Object
the identifier of a persistent instance that exists in the database
id
)

Implements org.hibernate.Session.getReference.

Return a reference to the persistent instance with the given class and identifier, making the assumption that the instance is still persistent in the database.
public Object
getReference(String
the entity name
entityName
,
Object
the identifier of a persistent instance that exists in the database
id
)

Implements org.hibernate.Session.getReference.

Return a reference to the persistent instance of the given named entity with the given identifier, making the assumption that the instance is still persistent in the database.
public <T> T
getReference(T
a detached persistent instance
object
)

Implements org.hibernate.Session.getReference.

Return a reference to the persistent instance with the same identity as the given instance, which might be detached, making the assumption that the instance is still persistent in the database.
public SessionFactory
getSessionFactory()

Implements org.hibernate.Session.getSessionFactory.

Get the session factory which created this session.
public SessionStatistics
getStatistics()

Implements org.hibernate.Session.getStatistics.

Get the statistics for this session.
public String
getTenantIdentifier()

Implements org.hibernate.SharedSessionContract.getTenantIdentifier.

Obtain the tenant identifier associated with this session.
public Object
getTenantIdentifierValue()

Implements org.hibernate.SharedSessionContract.getTenantIdentifierValue.

Obtain the tenant identifier associated with this session.
public Transaction
public boolean
isConnected()

Implements org.hibernate.SharedSessionContract.isConnected.

Check if the session is currently connected.
public boolean
isDefaultReadOnly()

Implements org.hibernate.Session.isDefaultReadOnly.

Will entities and proxies that are loaded into this session be made read-only by default?
public boolean
isDirty()

Implements org.hibernate.Session.isDirty.

Does this session contain any changes which must be synchronized with the database?
public boolean
isFetchProfileEnabled(String
the name of the profile
name
)

Implements org.hibernate.Session.isFetchProfileEnabled.

Is the fetch profile with the given name enabled in this session?
public boolean
public boolean
public boolean
isReadOnly(Object
an entity or proxy
entityOrProxy
)

Implements org.hibernate.Session.isReadOnly.

Is the specified entity or proxy read-only?
public boolean
isSubselectFetchingEnabled()

Implements org.hibernate.Session.isSubselectFetchingEnabled.

Determine if subselect fetching is enabled in this session.
public void
public <T> T
load(Class<T>
a persistent class
theClass
,
Object
a valid identifier of an existing persistent instance of the class
id
,
LockMode
the lock level
lockMode
)

Implements org.hibernate.Session.load.

Deprecated
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.
public <T> T
load(Class<T>
a persistent class
theClass
,
Object
a valid identifier of an existing persistent instance of the class
id
,
LockOptions
contains the lock level
lockOptions
)

Implements org.hibernate.Session.load.

Deprecated
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.
public Object
load(String
the entity name
entityName
,
Object
a valid identifier of an existing persistent instance of the class
id
,
LockMode
the lock level
lockMode
)

Implements org.hibernate.Session.load.

Deprecated
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.
public Object
load(String
the entity name
entityName
,
Object
a valid identifier of an existing persistent instance of the class
id
,
LockOptions
contains the lock level
lockOptions
)

Implements org.hibernate.Session.load.

Deprecated
Return the persistent instance of the given entity class with the given identifier, obtaining the specified lock mode, assuming the instance exists.
public <T> T
load(Class<T>
a persistent class
theClass
,
Object
a valid identifier of an existing persistent instance of the class
id
)

Implements org.hibernate.Session.load.

Deprecated
Return the persistent instance of the given entity class with the given identifier, making the assumption that the instance exists in the database.
public Object
load(String
the entity name
entityName
,
Object
a valid identifier of an existing persistent instance of the class
id
)

Implements org.hibernate.Session.load.

Deprecated
Return the persistent instance of the given entity class with the given identifier, making the assumption that the instance exists in the database.
public void
load(Object object, Object id)

Implements org.hibernate.Session.load.

Read the persistent state associated with the given identifier into the given transient instance.
public void
lock(Object
a persistent or transient instance
object
,
LockMode
the lock level
lockMode
)

Implements org.hibernate.Session.lock.

Obtain the specified lock level on the given managed instance associated with this session.
public void
lock(String
the name of the entity
entityName
,
Object
a persistent or transient instance
object
,
LockMode
the lock level
lockMode
)

Implements org.hibernate.Session.lock.

Deprecated
Obtain the specified lock level on the given managed instance associated with this session.
public void
lock(Object
a persistent or transient instance
object
,
LockOptions
the lock options
lockOptions
)

Implements org.hibernate.Session.lock.

Obtain a lock on the given managed instance associated with this session, using the given lock options.
public void
lock(Object
entity instance
entity
,
LockModeType
lock mode
lockMode
)

Implements jakarta.persistence.EntityManager.lock.

Lock an entity instance that is contained in the persistence context with the specified lock mode type.
public void
lock(Object
entity instance
entity
,
LockModeType
lock mode
lockMode
,
Map<String, Object>
standard and vendor-specific properties and hints
properties
)

Implements jakarta.persistence.EntityManager.lock.

Lock an entity instance that is contained in the persistence context with the specified lock mode type and with specified properties.
public <T> T
merge(T
a detached instance with state to be copied
object
)

Implements org.hibernate.Session.merge.

Copy the state of the given object onto the persistent object with the same identifier.
public <T> T
merge(String
the entity name
entityName
,
T
a detached instance with state to be copied
object
)

Implements org.hibernate.Session.merge.

Copy the state of the given object onto the persistent object with the same identifier.
public void
persist(Object
a transient instance to be made persistent
object
)

Implements org.hibernate.Session.persist.

Make a transient instance persistent and mark it for later insertion in the database.
public void
persist(String
the entity name
entityName
,
Object
a transient instance to be made persistent
object
)

Implements org.hibernate.Session.persist.

Make a transient instance persistent and mark it for later insertion in the database.
public void
refresh(Object
a persistent or detached instance
object
)

Implements org.hibernate.Session.refresh.

Reread the state of the given managed instance associated with this session from the underlying database.
public void
refresh(String
the name of the entity
entityName
,
Object
a persistent or detached instance
object
)

Implements org.hibernate.Session.refresh.

Deprecated
Reread the state of the given managed instance associated with this session from the underlying database.
public void
refresh(Object
a persistent or detached instance
object
,
LockMode
the lock mode to use
lockMode
)

Implements org.hibernate.Session.refresh.

Reread the state of the given managed instance from the underlying database, obtaining the given LockMode.
public void
refresh(Object
a persistent or detached instance
object
,
LockOptions
contains the lock mode to use
lockOptions
)

Implements org.hibernate.Session.refresh.

Reread the state of the given managed instance from the underlying database, obtaining the given LockMode.
public void
refresh(String
the name of the entity
entityName
,
Object
a persistent or detached instance
object
,
LockOptions
contains the lock mode to use
lockOptions
)

Implements org.hibernate.Session.refresh.

Deprecated
Reread the state of the given managed instance from the underlying database, obtaining the given LockMode.
public void
refresh(Object
entity instance
entity
,
Map<String, Object>
standard and vendor-specific properties and hints
properties
)

Implements jakarta.persistence.EntityManager.refresh.

Refresh the state of the instance from the database, using the specified properties, and overwriting changes made to the entity, if any.
public void
refresh(Object
entity instance
entity
,
LockModeType
lock mode
lockMode
)

Implements jakarta.persistence.EntityManager.refresh.

Refresh the state of the instance from the database, overwriting changes made to the entity, if any, and lock it with respect to given lock mode type.
public void
refresh(Object
entity instance
entity
,
LockModeType
lock mode
lockMode
,
Map<String, Object>
standard and vendor-specific properties and hints
properties
)

Implements jakarta.persistence.EntityManager.refresh.

Refresh the state of the instance from the database, overwriting changes made to the entity, if any, and lock it with respect to given lock mode type and with specified properties.
public void
remove(Object
the managed persistent instance to remove
object
)

Implements org.hibernate.Session.remove.

Mark a persistence instance associated with this session for removal from the underlying database.
public void
replicate(Object
a detached instance of a persistent class
object
,
ReplicationMode
the replication mode to use
replicationMode
)

Implements org.hibernate.Session.replicate.

Deprecated
Persist the state of the given detached instance, reusing the current identifier value.
public void
replicate(String
the entity name
entityName
,
Object
a detached instance of a persistent class
object
,
ReplicationMode
the replication mode to use
replicationMode
)

Implements org.hibernate.Session.replicate.

Deprecated
Persist the state of the given detached instance, reusing the current identifier value.
public Object
save(Object
a transient instance of a persistent class
object
)

Implements org.hibernate.Session.save.

Deprecated
Persist the given transient instance, first assigning a generated identifier.
public Object
save(String
the entity name
entityName
,
Object
a transient instance of a persistent class
object
)

Implements org.hibernate.Session.save.

Deprecated
Persist the given transient instance, first assigning a generated identifier.
public void
saveOrUpdate(Object
a transient or detached instance containing new or updated state
object
)

Implements org.hibernate.Session.saveOrUpdate.

Deprecated
Either save(Object) or update(Object) the given instance, depending upon resolution of the unsaved-value checks (see the manual for discussion of unsaved-value checking).
public void
saveOrUpdate(String
the entity name
entityName
,
Object
a transient or detached instance containing new or updated state
object
)

Implements org.hibernate.Session.saveOrUpdate.

Deprecated
Either save(String, Object) or update(String, Object) the given instance, depending upon resolution of the unsaved-value checks (see the manual for discussion of unsaved-value checking).
public SharedSessionBuilder
sessionWithOptions()

Implements org.hibernate.Session.sessionWithOptions.

Obtain a Session builder with the ability to copy certain information from this session.
public void
setCacheMode(CacheMode
the new cache mode
cacheMode
)

Implements org.hibernate.Session.setCacheMode.

Set the current cache mode for this session.
public void
setCacheRetrieveMode(CacheRetrieveMode
a JPA-defined CacheRetrieveMode
cacheRetrieveMode
)

Implements org.hibernate.Session.setCacheRetrieveMode.

Enable or disable reads from the second-level cache.
public void
setCacheStoreMode(CacheStoreMode
a JPA-defined CacheStoreMode
cacheStoreMode
)

Implements org.hibernate.Session.setCacheStoreMode.

Enable or disable writes to the second-level cache.
public void
setDefaultReadOnly(boolean
true, the default for loaded entities/proxies is read-only; false, the default for loaded entities/proxies is modifiable
readOnly
)

Implements org.hibernate.Session.setDefaultReadOnly.

Change the default for entities and proxies loaded into this session from modifiable to read-only mode, or from modifiable to read-only mode.
public void
setFetchBatchSize(int
the maximum batch size for batch fetching
batchSize
)

Implements org.hibernate.Session.setFetchBatchSize.

Set the maximum batch size for batch fetching associations by id in this session.
public void
setFlushMode(FlushModeType flushMode)

Implements org.hibernate.Session.setFlushMode.

Set the current JPA flush mode for this session.
public void
setHibernateFlushMode(FlushMode
the new FlushMode
flushMode
)

Implements org.hibernate.Session.setHibernateFlushMode.

Set the current flush mode for this session.
public void
setJdbcBatchSize(Integer
the new session-level JDBC batch size
jdbcBatchSize
)

Implements org.hibernate.SharedSessionContract.setJdbcBatchSize.

Set the session-level JDBC batch size.
public void
setProperty(String
name of property or hint
propertyName
,
Object
value for property or hint
value
)

Implements jakarta.persistence.EntityManager.setProperty.

Set an entity manager property or hint.
public void
setReadOnly(Object
an entity or proxy
entityOrProxy
,
boolean
true if the entity or proxy should be made read-only; false if the entity or proxy should be made modifiable
readOnly
)

Implements org.hibernate.Session.setReadOnly.

Set an unmodified persistent object to read-only mode, or a read-only object to modifiable mode.
public void
setSubselectFetchingEnabled(boolean
true to enable subselect fetching
enabled
)

Implements org.hibernate.Session.setSubselectFetchingEnabled.

Enable or disable subselect fetching in this session.
public <T> T
unwrap(Class<T>
the class of the object to be returned. This is normally either the underlying EntityManager implementation class or an interface that it implements.
cls
)

Implements jakarta.persistence.EntityManager.unwrap.

Return an object of the specified type to allow access to the provider-specific API.
public void
update(Object
a detached instance containing updated state
object
)

Implements org.hibernate.Session.update.

Deprecated
Update the persistent instance with the identifier of the given detached instance.
public void
update(String
the entity name
entityName
,
Object
a detached instance containing updated state
object
)

Implements org.hibernate.Session.update.

Deprecated
Update the persistent instance with the identifier of the given detached instance.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait