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

public Class SessionLazyDelegator

extends Object
implements Session
Class Inheritance
All Implemented Interfaces
org.hibernate.Session, java.io.Closeable, java.lang.AutoCloseable, org.hibernate.jpa.HibernateEntityManager, org.hibernate.query.QueryProducer, javax.persistence.EntityManager, org.hibernate.SharedSessionContract, java.io.Serializable
Imports
java.io.Serializable, java.sql.Connection, java.util.List, .Map, java.util.function.Supplier, javax.persistence.EntityGraph, .EntityManagerFactory, .FlushModeType, .LockModeType, .StoredProcedureQuery, javax.persistence.criteria.CriteriaBuilder, .CriteriaDelete, .CriteriaQuery, .CriteriaUpdate, javax.persistence.metamodel.Metamodel, org.hibernate.CacheMode, .Criteria, .Filter, .FlushMode, .HibernateException, .IdentifierLoadAccess, .LobHelper, .LockMode, .LockOptions, .MultiIdentifierLoadAccess, .NaturalIdLoadAccess, .Query, .ReplicationMode, .Session, .SessionEventListener, .SessionFactory, .SharedSessionBuilder, .SimpleNaturalIdLoadAccess, .Transaction, .TypeHelper, .UnknownProfileException, org.hibernate.graph.RootGraph, org.hibernate.jdbc.ReturningWork, .Work, org.hibernate.procedure.ProcedureCall, org.hibernate.query.NativeQuery, org.hibernate.stat.SessionStatistics

Deprecated

as a consequence of Session being deprecated. See corresponding docs for further information.

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 (C) 2022 Red Hat Inc.

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.

Build a LockRequest that specifies the LockMode, pessimistic lock timeout and lock scope.
public 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 the specified entity type by 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 the specified entity by 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 entities at once as specified by primary key values.
public 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 entities at once as specified by primary key values.
public 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 the specified entity by its natural id.
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 the specified entity by its natural id.
public 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 the specified entity by its natural id.
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 the specified entity by its simple (single attribute) natural id.
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
public boolean
contains(String
The entity name
entityName
,
Object
an instance of a persistent class
object
)

Implements org.hibernate.Session.contains.

Check if this entity is associated with this Session.
public boolean
contains(Object
entity instance
entity
)

Implements javax.persistence.EntityManager.contains.

Check if the instance is a managed entity instance belonging to the current persistence context.
public Criteria
createCriteria(Class<T>
The class, which is an entity, or has entity subclasses/implementors
persistentClass
)

Implements org.hibernate.SharedSessionContract.createCriteria.

Deprecated
Create Criteria instance for the given class (entity or subclasses/implementors).
public Criteria
createCriteria(Class<T>
The class, which is an entity, or has entity subclasses/implementors
persistentClass
,
String
The alias to use
alias
)

Implements org.hibernate.SharedSessionContract.createCriteria.

Deprecated
Create Criteria instance for the given class (entity or subclasses/implementors), using a specific alias.
public Criteria
createCriteria(String
The entity name
entityName
)

Implements org.hibernate.SharedSessionContract.createCriteria.

Deprecated
Create Criteria instance for the given entity name.
public Criteria
createCriteria(String
The entity name
entityName
,
String
The alias to use
alias
)

Implements org.hibernate.SharedSessionContract.createCriteria.

Deprecated
Create Criteria instance for the given entity name, using a specific alias.
public <T> RootGraph<T>
createEntityGraph(Class<T>
class of entity graph
rootType
)

Implements org.hibernate.Session.createEntityGraph.

Return a mutable EntityGraph that can be used to dynamically create an EntityGraph.
public RootGraph<?>
createEntityGraph(String
name of an entity graph
graphName
)

Implements org.hibernate.Session.createEntityGraph.

Return a mutable copy of the named EntityGraph.
public Query<R>
createFilter(Object
a persistent collection
collection
,
String
a Hibernate query fragment.
queryString
)

Implements org.hibernate.Session.createFilter.

Deprecated
Create a Query instance for the given collection and filter string.
public <T> Query<T>
createNamedQuery(String
the name of a query defined in metadata
name
,
Class<T>
the type of the query result
resultType
)

Implements org.hibernate.Session.createNamedQuery.

Deprecated as a consequence of Query being deprecated.
Create an instance of TypedQuery for executing a Java Persistence query language named query.
public Query<R>
createNamedQuery(String
the name of a query defined in metadata
name
)

Implements org.hibernate.query.QueryProducer.createNamedQuery, javax.persistence.EntityManager.createNamedQuery.

Deprecated as a consequence of Query being deprecated.
Create an instance of Query for executing a named query (in the Java Persistence query language or in native SQL).
public StoredProcedureQuery
createNamedStoredProcedureQuery(String
name assigned to the stored procedure query in metadata
name
)

Implements javax.persistence.EntityManager.createNamedStoredProcedureQuery.

Create an instance of StoredProcedureQuery for executing a stored procedure in the database.
public NativeQuery<T>
createNativeQuery(String
a native SQL query string
sqlString
)

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

Deprecated as a consequence of NativeQuery being 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
,
String
the name of the result set mapping
resultSetMapping
)

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

Deprecated as a consequence of NativeQuery being deprecated.
Create an instance of Query for executing a native SQL query.
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, javax.persistence.EntityManager.createNativeQuery.

Deprecated as a consequence of NativeQuery being deprecated.
Create an instance of Query for executing a native SQL query.
public <T> Query<T>
createQuery(String
a Java Persistence query string
queryString
,
Class<T>
the type of the query result
resultType
)

Implements org.hibernate.Session.createQuery.

Deprecated as a consequence of Query being deprecated.
Create an instance of TypedQuery for executing a Java Persistence query language statement.
public <T> Query<T>
createQuery(CriteriaQuery<T>
a criteria query object
criteriaQuery
)

Implements org.hibernate.Session.createQuery.

Deprecated as a consequence of Query being deprecated.
Create an instance of TypedQuery for executing a criteria query.
public Query<R>
createQuery(CriteriaUpdate<T>
a criteria update query object
updateQuery
)

Implements org.hibernate.Session.createQuery.

Deprecated as a consequence of Query being deprecated.
Create an instance of Query for executing a criteria update query.
public Query<R>
createQuery(CriteriaDelete<T>
a criteria delete query object
deleteQuery
)

Implements org.hibernate.Session.createQuery.

Deprecated as a consequence of Query being deprecated.
Create an instance of Query for executing a criteria delete query.
public Query<R>
createQuery(String
a Java Persistence query string
queryString
)

Implements org.hibernate.SharedSessionContract.createQuery, javax.persistence.EntityManager.createQuery, org.hibernate.query.QueryProducer.createQuery.

Deprecated as a consequence of Query being deprecated.
Create an instance of Query for executing a Java Persistence query language statement.
public NativeQuery<T>
createSQLQuery(String
The SQL query
queryString
)

Implements org.hibernate.Session.createSQLQuery.

Deprecated as a consequence of NativeQuery being deprecated.
Create a NativeQuery instance for the given SQL query string.
public ProcedureCall
createStoredProcedureCall(String
The name of the procedure.
procedureName
)

Implements org.hibernate.SharedSessionContract.createStoredProcedureCall.

Deprecated as a consequence of ProcedureCall being deprecated.
Creates a call to a stored procedure.
public ProcedureCall
createStoredProcedureCall(String
The name of the procedure.
procedureName
,
Class<T>...
The entity(s) to map the result on to.
resultClasses
)

Implements org.hibernate.SharedSessionContract.createStoredProcedureCall.

Deprecated as a consequence of ProcedureCall being deprecated.
Creates a call to a stored procedure with specific 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.

Deprecated as a consequence of ProcedureCall being deprecated.
Creates a call to a stored procedure with specific result set entity mappings.
public StoredProcedureQuery
createStoredProcedureQuery(String
name of the stored procedure in the database
procedureName
)

Implements javax.persistence.EntityManager.createStoredProcedureQuery.

Create an instance of StoredProcedureQuery for executing a stored procedure in the database.
public StoredProcedureQuery
createStoredProcedureQuery(String
name of the stored procedure in the database
procedureName
,
Class<T>...
classes to which the result sets produced by the stored procedure are to be mapped
resultClasses
)

Implements javax.persistence.EntityManager.createStoredProcedureQuery.

Create an instance of StoredProcedureQuery for executing a stored procedure in the database.
public StoredProcedureQuery
createStoredProcedureQuery(String
name of the stored procedure in the database
procedureName
,
String...
the names of the result set mappings to be used in mapping result sets returned by the stored procedure
resultSetMappings
)

Implements javax.persistence.EntityManager.createStoredProcedureQuery.

Create an instance of StoredProcedureQuery for executing a stored procedure in the database.
public void
delete(Object
the instance to be removed
object
)

Implements org.hibernate.Session.delete.

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.

Remove a persistent instance from the datastore.
public void
detach(Object
entity instance
entity
)

Implements javax.persistence.EntityManager.detach.

Remove the given entity from the persistence context, causing a managed entity to become detached.
public void
disableFetchProfile(String
The name of the fetch profile to be disabled.
name
)

Implements org.hibernate.Session.disableFetchProfile.

Disable a particular fetch profile on 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 Connection
disconnect()

Implements org.hibernate.Session.disconnect.

Disconnect the session from its underlying JDBC connection.
public <T> T
doReturningWork(ReturningWork<T>
The work to be performed.
work
)

Overrides default org.hibernate.SharedSessionContract.doReturningWork.

Controller for allowing users to perform JDBC related work using the Connection managed by this Session.
public void
doWork(Work
The work to be performed.
work
)

Overrides default org.hibernate.SharedSessionContract.doWork.

Controller for allowing users to perform JDBC related work using the Connection managed by this Session.
public void
enableFetchProfile(String
The name of the fetch profile to be enabled.
name
)

Implements org.hibernate.Session.enableFetchProfile.

Enable a particular fetch profile on 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 entity to evict
object
)

Implements org.hibernate.Session.evict.

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

Implements javax.persistence.EntityManager.find.

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

Implements javax.persistence.EntityManager.find.

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

Implements javax.persistence.EntityManager.find.

Find by primary key and lock.
public <T> 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 javax.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
,
Serializable
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
,
Serializable
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
,
Serializable
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
,
Serializable
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
,
Serializable
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
,
Serializable
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.
public CriteriaBuilder
getCriteriaBuilder()

Implements javax.persistence.EntityManager.getCriteriaBuilder.

Return an instance of CriteriaBuilder for the creation of CriteriaQuery objects.
public LockMode
getCurrentLockMode(Object
a persistent instance
object
)

Implements org.hibernate.Session.getCurrentLockMode.

Determine the current lock mode of the given object.
public Object
getDelegate()

Implements javax.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
name of an existing entity graph
graphName
)

Implements org.hibernate.Session.getEntityGraph.

Return a named EntityGraph.
public <T> List<EntityGraph<? super T>>
getEntityGraphs(Class<T>
entity class
entityClass
)

Overrides default org.hibernate.Session.getEntityGraphs.

Return all named EntityGraphs that have been defined for the provided class type.
public EntityManagerFactory
getEntityManagerFactory()

Implements javax.persistence.EntityManager.getEntityManagerFactory.

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

Implements org.hibernate.Session.getEntityName.

Return the entity name for a persistent entity.
public FlushModeType
getFlushMode()

Implements org.hibernate.Session.getFlushMode.

Get the flush mode that applies to all objects contained in the persistence context.
public FlushMode
getHibernateFlushMode()

Implements org.hibernate.Session.getHibernateFlushMode.

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

Implements org.hibernate.Session.getIdentifier.

Return the identifier value of the given entity as 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
getLobHelper()

Implements org.hibernate.Session.getLobHelper.

Retrieve this session's helper/delegate for creating LOB instances.
public LockModeType
getLockMode(Object
entity instance
entity
)

Implements javax.persistence.EntityManager.getLockMode.

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

Implements javax.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 pre-defined query
name
)

Implements org.hibernate.query.QueryProducer.getNamedNativeQuery.

Deprecated as a consequence of NativeQuery being 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.

Deprecated as a consequence of ProcedureCall being deprecated.
Gets a ProcedureCall based on a named template
public Query<R>
getNamedQuery(String
the name of a pre-defined, named query
queryName
)

Implements org.hibernate.SharedSessionContract.getNamedQuery, org.hibernate.query.QueryProducer.getNamedQuery.

Deprecated as a consequence of Query being deprecated.
Create a Query instance for the named query.
public Query<R>
getNamedSQLQuery(String
The name of the pre-defined query
name
)

Overrides default org.hibernate.query.QueryProducer.getNamedSQLQuery.

Deprecated
Get a NativeQuery instance for a named native SQL query
public Map<String, Object>
getProperties()

Implements javax.persistence.EntityManager.getProperties.

Get the properties and hints and associated values that are in effect for the entity manager.
public <T> T
getReference(T
a detached persistent instance
object
)

Overrides default 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 <T> T
getReference(Class<T>
entity class
entityClass
,
Object
primary key
primaryKey
)

Implements javax.persistence.EntityManager.getReference.

Get an instance, whose state may be lazily fetched.
public Session
getSession()

Implements org.hibernate.jpa.HibernateEntityManager.getSession.

Deprecated as a consequence of Session being deprecated.
Retrieve a reference to the Hibernate org.hibernate.Session used by this javax.persistence.EntityManager.
public SessionFactory
getSessionFactory()

Implements org.hibernate.Session.getSessionFactory.

Deprecated as a consequence of SessionFactory being deprecated.
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 Transaction
public TypeHelper
getTypeHelper()

Implements org.hibernate.Session.getTypeHelper.

Convenience access to the TypeHelper associated with this session's SessionFactory.
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 to be checked.
name
)

Implements org.hibernate.Session.isFetchProfileEnabled.

Is a particular fetch profile enabled on this session?
public boolean
isJoinedToTransaction()

Implements javax.persistence.EntityManager.isJoinedToTransaction.

Determine whether the entity manager is joined to the current transaction.
public boolean
public boolean
isReadOnly(Object
an entity or HibernateProxy
entityOrProxy
)

Implements org.hibernate.Session.isReadOnly.

Is the specified entity or proxy read-only?
public void
joinTransaction()

Implements javax.persistence.EntityManager.joinTransaction.

Indicate to the entity manager that a JTA transaction is active and join the persistence context to it.
public <T> T
load(Class<T>
a persistent class
theClass
,
Serializable
a valid identifier of an existing persistent instance of the class
id
,
LockMode
the lock level
lockMode
)

Implements org.hibernate.Session.load.

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
,
Serializable
a valid identifier of an existing persistent instance of the class
id
,
LockOptions
contains the lock level
lockOptions
)

Implements org.hibernate.Session.load.

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
a persistent class
entityName
,
Serializable
a valid identifier of an existing persistent instance of the class
id
,
LockMode
the lock level
lockMode
)

Implements org.hibernate.Session.load.

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
a persistent class
entityName
,
Serializable
a valid identifier of an existing persistent instance of the class
id
,
LockOptions
contains the lock level
lockOptions
)

Implements org.hibernate.Session.load.

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
,
Serializable
a valid identifier of an existing persistent instance of the class
id
)

Implements org.hibernate.Session.load.

Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists.
public Object
load(String
a persistent class
entityName
,
Serializable
a valid identifier of an existing persistent instance of the class
id
)

Implements org.hibernate.Session.load.

Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists.
public void
load(Object
an "empty" instance of the persistent class
object
,
Serializable
a valid identifier of an existing persistent instance of the class
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 upon the given object.
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.

Obtain the specified lock level upon the given object.
public void
lock(Object
entity instance
entity
,
LockModeType
lock mode
lockMode
)

Implements javax.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 javax.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 Object
merge(Object
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 Object
merge(String
The entity name
entityName
,
Object
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.
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.
public void
reconnect(Connection
a JDBC connection
connection
)

Implements org.hibernate.Session.reconnect.

Reconnect to the given JDBC connection.
public void
refresh(Object
a persistent or detached instance
object
)

Implements org.hibernate.Session.refresh.

Re-read the state of the given instance from the underlying database.
public void
refresh(String
a persistent class
entityName
,
Object
a persistent or detached instance
object
)

Implements org.hibernate.Session.refresh.

Re-read the state of the given instance 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.

Re-read the state of the given instance from the underlying database, with 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.

Re-read the state of the given instance from the underlying database, with the given LockMode.
public void
refresh(String
a persistent class
entityName
,
Object
a persistent or detached instance
object
,
LockOptions
contains the lock mode to use
lockOptions
)

Implements org.hibernate.Session.refresh.

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

Implements javax.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 javax.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 javax.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
entity instance
entity
)

Implements javax.persistence.EntityManager.remove.

Remove the entity instance.
public void
replicate(Object
a detached instance of a persistent class
object
,
ReplicationMode
The replication mode to use
replicationMode
)

Implements org.hibernate.Session.replicate.

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.

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

Implements org.hibernate.Session.save.

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

Implements org.hibernate.Session.save.

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.

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.

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<T extends SharedSessionBuilder>
sessionWithOptions()

Implements org.hibernate.Session.sessionWithOptions.

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

Implements org.hibernate.Session.setCacheMode.

Set the cache mode.
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
setFlushMode(FlushMode
the new flush mode
flushMode
)

Implements org.hibernate.Session.setFlushMode.

Deprecated
Set the flush mode for this session.
public void
setFlushMode(FlushModeType
flush mode
flushMode
)

Implements javax.persistence.EntityManager.setFlushMode.

Set the flush mode that applies to all objects contained in the persistence context.
public void
setHibernateFlushMode(FlushMode
the new flush mode
flushMode
)

Implements org.hibernate.Session.setHibernateFlushMode.

Set the flush mode for this session.
public void
setJdbcBatchSize(Integer
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 javax.persistence.EntityManager.setProperty.

Set an entity manager property or hint.
public void
setReadOnly(Object
an entity or HibernateProxy
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 <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 javax.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.

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.

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