Top Description Inners Fields Constructors Methods
org.hibernate.internal

public Class SessionImpl

extends AbstractSessionImpl
implements EventSource, SessionImplementor, HibernateEntityManagerImplementor
Class Inheritance
All Implemented Interfaces
org.hibernate.jpa.spi.HibernateEntityManagerImplementor, org.hibernate.jpa.spi.HibernateEntityManagerFactoryAware, org.hibernate.ejb.HibernateEntityManager, org.hibernate.jpa.HibernateEntityManager, org.hibernate.query.QueryProducer, javax.persistence.EntityManager, org.hibernate.engine.spi.SessionImplementor, org.hibernate.engine.spi.SharedSessionContractImplementor, org.hibernate.query.spi.QueryProducerImplementor, org.hibernate.type.descriptor.WrapperOptions, org.hibernate.engine.jdbc.LobCreationContext, org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder.Options, org.hibernate.resource.jdbc.spi.JdbcSessionOwner, org.hibernate.SharedSessionContract, java.io.Serializable, org.hibernate.Session, java.io.Closeable, java.lang.AutoCloseable, org.hibernate.event.spi.EventSource
Imports
java.io.IOException, .InputStream, .ObjectInputStream, .ObjectOutputStream, .Reader, .Serializable, java.sql.Blob, .Clob, .Connection, .NClob, .SQLException, java.util.ArrayList, .Arrays, .Collections, .HashMap, .HashSet, .Iterator, .LinkedHashMap, .List, .Map, .Optional, .Set, java.util.function.Supplier, javax.persistence.CacheRetrieveMode, .CacheStoreMode, .EntityManager, .EntityNotFoundException, .FlushModeType, .LockModeType, .PersistenceException, .StoredProcedureQuery, .TransactionRequiredException, javax.persistence.criteria.CriteriaBuilder, org.hibernate.CacheMode, .Criteria, .FetchNotFoundException, .Filter, .FlushMode, .HibernateException, .IdentifierLoadAccess, .JDBCException, .LobHelper, .LockMode, .LockOptions, .MappingException, .MultiIdentifierLoadAccess, .NaturalIdLoadAccess, .ObjectDeletedException, .ObjectNotFoundException, .QueryException, .ReplicationMode, .ScrollMode, .Session, .SessionEventListener, .SessionException, .SharedSessionBuilder, .SimpleNaturalIdLoadAccess, .Transaction, .TransientObjectException, .TypeHelper, .TypeMismatchException, .UnknownProfileException, .UnresolvableObjectException, org.hibernate.bytecode.enhance.spi.interceptor.BytecodeLazyAttributeInterceptor, .EnhancementAsProxyLazinessInterceptor, org.hibernate.bytecode.spi.BytecodeEnhancementMetadata, org.hibernate.cfg.AvailableSettings, org.hibernate.collection.spi.PersistentCollection, org.hibernate.criterion.NaturalIdentifier, org.hibernate.engine.internal.StatefulPersistenceContext, org.hibernate.engine.jdbc.LobCreator, .NonContextualLobCreator, org.hibernate.engine.jdbc.spi.JdbcCoordinator, org.hibernate.engine.query.spi.FilterQueryPlan, .HQLQueryPlan, .NativeSQLQueryPlan, org.hibernate.engine.query.spi.sql.NativeSQLQuerySpecification, org.hibernate.engine.spi.ActionQueue, .CollectionEntry, .EffectiveEntityGraph, .EntityEntry, .EntityKey, .LoadQueryInfluencers, .NamedQueryDefinition, .PersistenceContext, .QueryParameters, .SessionFactoryImplementor, .SessionImplementor, .SharedSessionContractImplementor, .Status, .TypedValue, org.hibernate.engine.transaction.spi.TransactionImplementor, .TransactionObserver, org.hibernate.event.spi.AutoFlushEvent, .AutoFlushEventListener, .ClearEvent, .ClearEventListener, .DeleteEvent, .DeleteEventListener, .DirtyCheckEvent, .DirtyCheckEventListener, .EventSource, .EvictEvent, .EvictEventListener, .FlushEvent, .FlushEventListener, .InitializeCollectionEvent, .InitializeCollectionEventListener, .LoadEvent, .LoadEventListener, .LoadEventListener.LoadType, .LockEvent, .LockEventListener, .MergeEvent, .MergeEventListener, .PersistEvent, .PersistEventListener, .RefreshEvent, .RefreshEventListener, .ReplicateEvent, .ReplicateEventListener, .ResolveNaturalIdEvent, .ResolveNaturalIdEventListener, .SaveOrUpdateEvent, .SaveOrUpdateEventListener, org.hibernate.graph.GraphSemantic, .RootGraph, org.hibernate.graph.internal.RootGraphImpl, org.hibernate.graph.spi.RootGraphImplementor, org.hibernate.hql.spi.QueryTranslator, org.hibernate.internal.CriteriaImpl.CriterionEntry, org.hibernate.internal.log.DeprecationLogger, org.hibernate.internal.util.NullnessHelper, org.hibernate.jpa.QueryHints, org.hibernate.jpa.internal.util.CacheModeHelper, .ConfigurationHelper, .FlushModeTypeHelper, .LockModeTypeHelper, .LockOptionsHelper, org.hibernate.jpa.spi.HibernateEntityManagerImplementor, org.hibernate.loader.criteria.CriteriaLoader, org.hibernate.loader.custom.CustomLoader, .CustomQuery, org.hibernate.metamodel.spi.MetamodelImplementor, org.hibernate.param.CollectionFilterKeyParameterSpecification, org.hibernate.persister.collection.CollectionPersister, org.hibernate.persister.entity.EntityPersister, .MultiLoadOptions, .OuterJoinLoadable, org.hibernate.pretty.MessageHelper, org.hibernate.procedure.ProcedureCall, .ProcedureCallMemento, .UnknownSqlResultSetMappingException, org.hibernate.proxy.HibernateProxy, .LazyInitializer, org.hibernate.query.ImmutableEntityUpdateQueryHandlingMode, .Query, org.hibernate.query.internal.CollectionFilterImpl, org.hibernate.query.spi.ScrollableResultsImplementor, org.hibernate.resource.transaction.TransactionRequiredForJoinException, org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorImpl, org.hibernate.resource.transaction.spi.TransactionCoordinator, .TransactionStatus, org.hibernate.stat.SessionStatistics, org.hibernate.stat.internal.SessionStatisticsImpl, org.hibernate.stat.spi.StatisticsImplementor

Deprecated

as a consequence of AbstractSessionImpl, EventSource, SessionImplementor and HibernateEntityManagerImplementor being deprecated. See corresponding docs for further information.

Concrete implementation of a Session.

Exposes two interfaces:

This class is not thread-safe.

Authors
Gavin King, Steve Ebersole, Brett Meyer, Chris Cranford, Sanne Grinovero

Nested and Inner Type Summary

Modifier and TypeClass and Description
private abstract class
private class
private static class
private class
private class
private class
private static class
private class

Field Summary

Modifier and TypeField and Description
private transient ActionQueue
private boolean
private boolean
private transient int
private transient boolean
private transient LoadEvent
private transient LoadQueryInfluencers
private transient SessionImpl.LobHelperImpl
private LockOptions
private static final EntityManagerMessageLogger
private transient StatefulPersistenceContext
private Map<String, Object>
private boolean
private transient TransactionObserver

Constructor Summary

AccessConstructor and Description
public
SessionImpl(SessionFactoryImpl factory, SessionCreationOptions options)

Deprecated as a consequence of SessionFactoryImpl being deprecated.

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
protected void
public void
afterOperation(boolean
Was the operation a success
success
)

Check if there is a Hibernate or JTA transaction in progress and, if there is not, flush if necessary, make sure the connection has been committed (if it is not in autocommit mode) and run the after completion processing

public void
public void
afterTransactionBegin()

Implements org.hibernate.resource.jdbc.spi.JdbcSessionOwner.afterTransactionBegin.

A after-begin callback from the coordinator to its owner.
public void
afterTransactionCompletion(boolean
Was the transaction successful?
successful
,
boolean
Is this a delayed after transaction completion call (aka after a timeout)?
delayed
)

Overrides org.hibernate.internal.AbstractSharedSessionContract.afterTransactionCompletion.

Implements org.hibernate.resource.jdbc.spi.JdbcSessionOwner.afterTransactionCompletion.

An after-completion callback to the owner.
protected void
protected boolean
autoFlushIfRequired(Set<E> querySpaces)

detect in-memory changes, determine if the changes are to tables named in the query and, if so, complete execution the flush

public void
public String
bestGuessEntityName(Object object)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.bestGuessEntityName.

The best guess entity name for an entity not in an association
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 SessionImpl.IdentifierLoadAccessImpl<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> SessionImpl.IdentifierLoadAccessImpl<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.
protected void
protected void
protected void
private void
protected void
cleanupOnClose()

Overrides org.hibernate.internal.AbstractSharedSessionContract.cleanupOnClose.

clear all the internal collections, just to help the garbage collector, does not clear anything that is needed during the afterTransactionCompletion() phase
public void
clear()

Implements org.hibernate.Session.clear, javax.persistence.EntityManager.clear.

Completely clear the session.
public void
public void
private Map<String, Object>
public Connection
public boolean
contains(Object
entity instance
object
)

Implements javax.persistence.EntityManager.contains.

Check if the instance is a managed entity instance belonging to the current persistence context.
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.
protected ActionQueue
private ClearEvent
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.

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

Implements org.hibernate.SharedSessionContract.createCriteria.

Create Criteria instance for the given entity name, using a specific alias.
public Criteria
createCriteria(Class<T>
The class, which is an entity, or has entity subclasses/implementors
persistentClass
)

Implements org.hibernate.SharedSessionContract.createCriteria.

Create Criteria instance for the given class (entity or subclasses/implementors).
public Criteria
createCriteria(String
The entity name
entityName
)

Implements org.hibernate.SharedSessionContract.createCriteria.

Create Criteria instance for the given entity name.
public <T> RootGraphImplementor<T>
createEntityGraph(Class<T>
class of entity graph
rootType
)

Implements org.hibernate.engine.spi.SessionImplementor.createEntityGraph, javax.persistence.EntityManager.createEntityGraph.

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

Implements org.hibernate.engine.spi.SessionImplementor.createEntityGraph, javax.persistence.EntityManager.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 as a consequence of Query being deprecated.
Create a Query instance for the given collection and filter string.
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.
protected StatefulPersistenceContext
public ProcedureCall
createStoredProcedureCall(String
The name of the procedure.
procedureName
)

Overrides org.hibernate.internal.AbstractSharedSessionContract.createStoredProcedureCall.

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
,
String...
The explicit result set mapping(s) to use for mapping the results
resultSetMappings
)

Overrides org.hibernate.internal.AbstractSharedSessionContract.createStoredProcedureCall.

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
,
Class<T>...
The entity(s) to map the result on to.
resultClasses
)

Overrides org.hibernate.internal.AbstractSharedSessionContract.createStoredProcedureCall.

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.
protected void
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
delete(String entityName, Object object, boolean isCascadeDeleteEnabled, Set<E> transientEntities)

Implements org.hibernate.event.spi.EventSource.delete, org.hibernate.engine.spi.SessionImplementor.delete.

Cascade delete an entity instance
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.
protected CacheMode
private static CacheRetrieveMode
private static CacheStoreMode
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.
private void
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 any hard references to the entity that are held by the infrastructure (references held by application or other persistent instances are okay)
public int
executeNativeUpdate(NativeSQLQuerySpecification nativeQuerySpecification, QueryParameters queryParameters)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.executeNativeUpdate.

Execute a native SQL update or delete query
public int
executeUpdate(String query, QueryParameters queryParameters)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.executeUpdate.

Execute a HQL update or delete query
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
lockModeType
)

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
lockModeType
,
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.
private void
fireDelete(final DeleteEvent event)

private void
fireDelete(final DeleteEvent event, final Set<E> transientEntities)

private void
private void
private void
fireLock(String entityName, Object object, LockOptions options)

private void
fireLock(Object object, LockOptions options)

private void
private Object
private void
fireMerge(final Map<K, V> copiedAlready, final MergeEvent event)

private void
private void
firePersist(final Map<K, V> copiedAlready, final PersistEvent event)

private void
private void
fireRefresh(final Map<K, V> refreshedAlready, final RefreshEvent event)

private void
private void
private Serializable
private void
private void
public void
public void
public void
public <T> T
get(Class<T>
The entity type
entityClass
,
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 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 <T> T
get(Class<T>
The entity type
entityClass
,
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
entityClass
,
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
,
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 ActionQueue
public Serializable
getContextEntityIdentifier(Object object)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.getContextEntityIdentifier.

Get the id value for an object that is actually associated with the session.
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 int
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 RootGraphImplementor<?>
getEntityGraph(String
name of an existing entity graph
graphName
)

Implements org.hibernate.engine.spi.SessionImplementor.getEntityGraph, javax.persistence.EntityManager.getEntityGraph.

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

Overrides default org.hibernate.Session.getEntityGraphs.

Implements javax.persistence.EntityManager.getEntityGraphs.

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

Implements javax.persistence.EntityManager.getEntityManagerFactory.

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
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 EntityPersister
getEntityPersister(final String
optional entity name
entityName
,
final Object
the entity instance
object
)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.getEntityPersister.

Get the EntityPersister for any instance
public Object
getEntityUsingInterceptor(EntityKey key)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.getEntityUsingInterceptor.

Get the entity instance associated with the given Key, calling the Interceptor if necessary
private FilterQueryPlan
getFilterQueryPlan(Object collection, String filter, QueryParameters parameters, boolean shallow)

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 LoadQueryInfluencers
getLoadQueryInfluencers()

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.getLoadQueryInfluencers.

Get the load query influencers associated with this 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.
private LockOptions
private LockOptions
public LockOptions
getLockRequest(LockModeType
is the requested lock type
lockModeType
,
Map<String, Object>
are the lock properties
properties
)

Implements org.hibernate.jpa.spi.HibernateEntityManagerImplementor.getLockRequest.

Convert from JPA 2 javax.persistence.LockModeType & properties into org.hibernate.LockOptions
public MetamodelImplementor
getMetamodel()

Implements javax.persistence.EntityManager.getMetamodel.

Return an instance of Metamodel interface for access to the metamodel of the persistence unit.
private OuterJoinLoadable
public PersistenceContext
public PersistenceContext
getPersistenceContextInternal()

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.getPersistenceContextInternal.

This is similar to getPersistenceContext(), with two main differences: a) this version performs better as it allows for inlining and probably better prediction b) see SessionImplgetPersistenceContext() : it does some checks on the current state of the Session.
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.
private Serializable
private Boolean
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 SessionImplementor
public SessionFactoryImplementor
getSessionFactory()

Implements org.hibernate.engine.spi.SessionImplementor.getSessionFactory.

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
Get the session factory which created this session.
private Object
public SessionStatistics
getStatistics()

Implements org.hibernate.Session.getStatistics.

Get the statistics for this session.
private Transaction
public TypeHelper
getTypeHelper()

Implements org.hibernate.Session.getTypeHelper.

Convenience access to the TypeHelper associated with this session's SessionFactory.
public String
guessEntityName(Object object)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.guessEntityName.

The guessed entity name for an entity not in an association
public Object
immediateLoad(String entityName, Serializable id)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.immediateLoad.

Load the data for the object with the specified id into a newly created object.
public void
initializeCollection(PersistentCollection collection, boolean writing)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.initializeCollection.

Initialize the collection (if not already initialized)
protected void
initQueryFromNamedDefinition(Query<R> query, NamedQueryDefinition namedQueryDefinition)

Overrides org.hibernate.internal.AbstractSharedSessionContract.initQueryFromNamedDefinition.

Deprecated as a consequence of Query being deprecated.
public Object
instantiate(String entityName, Serializable id)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.instantiate.

Instantiate the entity class, initializing with the given identifier
public Object
instantiate(EntityPersister persister, Serializable id)

Implements org.hibernate.event.spi.EventSource.instantiate, org.hibernate.engine.spi.SharedSessionContractImplementor.instantiate.

give the interceptor an opportunity to override the default instantiation
private void
public Object
internalLoad(String entityName, Serializable id, boolean eager, boolean nullable)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.internalLoad.

Load an instance without checking if it was deleted.
public boolean
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
public boolean
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
public boolean
isJoinedToTransaction()

Implements javax.persistence.EntityManager.isJoinedToTransaction.

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

Implements org.hibernate.Session.isReadOnly.

Is the specified entity or proxy read-only?
private boolean
private boolean
isTransactionInProgress(boolean isMarkedRollbackConsideredActive)

public Iterator<E>
iterate(String query, QueryParameters queryParameters)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.iterate.

Execute an iterate() query
public Iterator<E>
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.
private void
joinTransaction(boolean explicitRequest)

public List<E>
list(String query, QueryParameters queryParameters)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.list.

Execute a find() query
public List<E>
public List<E>
public List<E>
listFilter(Object collection, String filter, QueryParameters queryParameters)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.listFilter.

Execute a filter
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 <T> T
load(Class<T>
a persistent class
entityClass
,
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 abstract org.hibernate.internal.AbstractSharedSessionContract.load.

Implements org.hibernate.Session.load.

Return the persistent instance of the given entity class with the given identifier, assuming that the instance exists.
public <T> T
load(Class<T>
a persistent class
entityClass
,
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
entityClass
,
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.
private EntityPersister
locateEntityPersister(Class<T> entityClass)

private EntityPersister
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
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
lockModeType
)

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
lockModeType
,
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.
private void
logRemoveOrphanBeforeUpdates(String timing, String entityName, Object entity)

private void
private void
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 Object
merge(Object
a detached instance with state to be copied
object
)

Implements org.hibernate.Session.merge, javax.persistence.EntityManager.merge.

Copy the state of the given object onto the persistent object with the same identifier.
public void
merge(String entityName, Object object, Map<K, V> copiedAlready)

Implements org.hibernate.event.spi.EventSource.merge, org.hibernate.engine.spi.SessionImplementor.merge.

Cascade merge an entity instance
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
persist(Object
a transient instance to be made persistent
object
)

Implements org.hibernate.Session.persist, javax.persistence.EntityManager.persist.

Make a transient instance persistent.
public void
persist(String entityName, Object object, Map<K, V> copiedAlready)

Implements org.hibernate.event.spi.EventSource.persist, org.hibernate.engine.spi.SessionImplementor.persist.

Cascade persist an entity instance
public void
persistOnFlush(String entityName, Object object, Map<K, V> copiedAlready)

Implements org.hibernate.event.spi.EventSource.persistOnFlush, org.hibernate.engine.spi.SessionImplementor.persistOnFlush.

Cascade persist an entity instance during the flush process
private void
readObject(ObjectInputStream
The input stream from which we are being read...
ois
)

Hides org.hibernate.internal.AbstractSharedSessionContract.readObject.

Used by JDK serialization...
public void
reconnect(Connection
a JDBC connection
conn
)

Implements org.hibernate.Session.reconnect.

Reconnect to the given JDBC connection.
private LoadEvent
recycleEventInstance(final LoadEvent event, final Serializable id, final String entityName)

Helper to avoid creating many new instances of LoadEvent: it's an allocation hot spot.

public void
refresh(Object
a persistent or detached instance
object
)

Implements org.hibernate.Session.refresh, javax.persistence.EntityManager.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(String entityName, Object object, Map<K, V> refreshedAlready)

Implements org.hibernate.event.spi.EventSource.refresh, org.hibernate.engine.spi.SessionImplementor.refresh.

Cascade refresh an entity instance
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
lockModeType
)

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
lockModeType
,
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
removeOrphanBeforeUpdates(String entityName, Object child)

Implements org.hibernate.event.spi.EventSource.removeOrphanBeforeUpdates, org.hibernate.engine.spi.SessionImplementor.removeOrphanBeforeUpdates.

A specialized type of deletion for orphan removal that must occur prior to queued inserts and updates.
protected void
public void
replicate(Object
a detached instance of a persistent class
obj
,
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
obj
,
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
obj
)

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
obj
)

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 ScrollableResultsImplementor
scroll(String query, QueryParameters queryParameters)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.scroll.

Execute a scroll() query
public ScrollableResultsImplementor
scroll(Criteria criteria, ScrollMode scrollMode)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.scroll.

Execute a criteria query
public ScrollableResultsImplementor
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
setAutoClear(boolean enabled)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.setAutoClear.

Enable/disable automatic cache clearing from after transaction completion (for EJB3)
public void
setDefaultReadOnly(boolean
true, the default for loaded entities/proxies is read-only; false, the default for loaded entities/proxies is modifiable
defaultReadOnly
)

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
public void
setFlushMode(FlushModeType
flush mode
flushModeType
)

Implements javax.persistence.EntityManager.setFlushMode.

Set the flush mode that applies to all objects contained in the persistence context.
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
entity
,
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 boolean
protected boolean
public void
startTransactionBoundary()

Overrides org.hibernate.internal.AbstractSharedSessionContract.startTransactionBoundary.

Implements org.hibernate.resource.jdbc.spi.JdbcSessionOwner.startTransactionBoundary.

Callback indicating recognition of entering into a transactional context whether that is explicitly via the Hibernate org.hibernate.Transaction API or via registration of Hibernate's JTA Synchronization impl with a JTA Transaction
private void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
private NaturalIdLoadAccess<T>

Returns:

A fully configured NaturalIdLoadAccess or null, if null is returned the standard CriteriaImpl execution should be performed
tryNaturalIdLoadAccess
(CriteriaImpl
The criteria to check as a complete natural identifier lookup.
criteria
)

Checks to see if the CriteriaImpl is a naturalId lookup that can be done via NaturalIdLoadAccess

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.
clazz
)

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
obj
)

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.
protected void
private void
writeObject(ObjectOutputStream
The output stream to which we are being written...
oos
)

Hides org.hibernate.internal.AbstractSharedSessionContract.writeObject.

Used by JDK serialization...