Top Description Fields Constructors Methods
org.hibernate.internal

public Class StatelessSessionImpl

extends AbstractSharedSessionContract
implements StatelessSession
Class Inheritance
All Implemented Interfaces
org.hibernate.StatelessSession, org.hibernate.SharedSessionContract, java.io.Serializable, java.io.Closeable, java.lang.AutoCloseable, org.hibernate.query.QueryProducer
Imports
java.util.Set, jakarta.persistence.EntityGraph, org.hibernate.CacheMode, .FlushMode, .HibernateException, .LockMode, .SessionException, .StatelessSession, .TransientObjectException, .UnresolvableObjectException, org.hibernate.bytecode.enhance.spi.interceptor.EnhancementAsProxyLazinessInterceptor, org.hibernate.bytecode.spi.BytecodeEnhancementMetadata, org.hibernate.cache.spi.access.EntityDataAccess, org.hibernate.collection.spi.PersistentCollection, org.hibernate.engine.internal.StatefulPersistenceContext, org.hibernate.engine.spi.EffectiveEntityGraph, .EntityHolder, .EntityKey, .LoadQueryInfluencers, .PersistenceContext, .PersistentAttributeInterceptable, .PersistentAttributeInterceptor, org.hibernate.engine.transaction.internal.jta.JtaStatusHelper, org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform, org.hibernate.graph.GraphSemantic, org.hibernate.graph.spi.RootGraphImplementor, org.hibernate.loader.ast.spi.CascadingFetchProfile, org.hibernate.persister.collection.CollectionPersister, org.hibernate.persister.entity.EntityPersister, org.hibernate.proxy.LazyInitializer, org.hibernate.generator.Generator, .BeforeExecutionGenerator, org.hibernate.tuple.entity.EntityMetamodel, jakarta.transaction.SystemException

Concrete implementation of the StatelessSession API.

Exposes two interfaces:

This class is not thread-safe.

Authors
Gavin King, Steve Ebersole

Field Summary

Modifier and TypeField and Description
private final boolean
private final LoadQueryInfluencers
private static final CoreMessageLogger
private final PersistenceContext
Inherited from org.hibernate.internal.AbstractSharedSessionContract:
closedfastSessionServiceswaitingForAutoClose

Constructor Summary

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

Deprecated as a consequence of SessionFactoryImpl being deprecated.

Method Summary

Modifier and TypeMethod and Description
public void
afterOperation(boolean
true if the operation a success
success
)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.afterOperation.

Check if there is a Hibernate or JTA transaction in progress and, if there is not, flush if necessary, making sure that the connection has been committed (if it is not in autocommit mode), and finally run the after completion processing.
public void
afterScrollOperation()

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.afterScrollOperation.

Called after each operation on a org.hibernate.ScrollableResults, providing an opportunity for a stateless session to clear its temporary persistence context.
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.
public StatelessSession
public boolean
autoFlushIfRequired(Set<String>
the tables named in the query.
querySpaces
)

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.autoFlushIfRequired.

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.

Obtain the best estimate of the entity name of the given entity instance, which is not involved in an association, by also considering information held in the proxy, and whether the object is already associated with this session.
private Object
public void
delete(Object
a detached entity instance
entity
)

Implements org.hibernate.StatelessSession.delete.

Delete a row.
public void
delete(String
The entityName for the entity to be deleted
entityName
,
Object
a detached entity instance
entity
)

Implements org.hibernate.StatelessSession.delete.

Delete a row.
public void
fetch(Object
a lazy-loaded association
association
)

Implements org.hibernate.StatelessSession.fetch.

Fetch an association that's configured for lazy loading.
public void
public void
public <T> T
get(Class<T>
The class of the entity to retrieve
entityClass
,
Object
The id of the entity to retrieve
id
)

Implements org.hibernate.StatelessSession.get.

Retrieve a row.
public <T> T
get(Class<T>
The class of the entity to retrieve
entityClass
,
Object
The id of the entity to retrieve
id
,
LockMode
The lock mode to apply to the entity
lockMode
)

Implements org.hibernate.StatelessSession.get.

Retrieve a row, obtaining the specified lock mode.
public Object
get(String
The name of the entity to retrieve
entityName
,
Object
The id of the entity to retrieve
id
)

Implements org.hibernate.StatelessSession.get.

Retrieve a row.
public Object
get(String
The name of the entity to retrieve
entityName
,
Object
The id of the entity to retrieve
id
,
LockMode
The lock mode to apply to the entity
lockMode
)

Implements org.hibernate.StatelessSession.get.

Retrieve a row, obtaining the specified lock mode.
public <T> T
get(EntityGraph<T> graph, GraphSemantic
a GraphSemantic specifying how the graph should be interpreted
graphSemantic
,
Object
The id of the entity to retrieve
id
)

Implements org.hibernate.StatelessSession.get.

Retrieve a row, fetching associations specified by the given EntityGraph.
public <T> T
get(EntityGraph<T> graph, GraphSemantic
a GraphSemantic specifying how the graph should be interpreted
graphSemantic
,
Object
The id of the entity to retrieve
id
,
LockMode
The lock mode to apply to the entity
lockMode
)

Implements org.hibernate.StatelessSession.get.

Retrieve a row, fetching associations specified by the given EntityGraph, and obtaining the specified lock mode.
public CacheMode
public Object
getContextEntityIdentifier(Object object)

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

Return the identifier of the persistent object, or null if it is not associated with this session.
private EntityPersister
public EntityPersister
getEntityPersister(String entityName, Object object)

public Object
getEntityUsingInterceptor(EntityKey key)

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

Get the entity instance associated with the given EntityKey, calling the Interceptor if necessary.
private JtaPlatform
public LoadQueryInfluencers
private LockMode
public PersistenceContext
public PersistenceContext
getPersistenceContextInternal()

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

Similar to getPersistenceContext(), with two differences:
  1. this version performs better as it allows for inlining and probably better prediction, and
  2. it skips some checks of the current state of the session.
public String
guessEntityName(Object entity)

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

Obtain an estimate of the entity name of the given entity instance, which is not involved in an association, using only the org.hibernate.EntityNameResolver.
public Object
public void
initializeCollection(PersistentCollection<?> collection, boolean writing)

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

Initialize the given collection (if not already initialized).
public Object
insert(Object
a new transient instance
entity
)

Implements org.hibernate.StatelessSession.insert.

Insert a row.
public Object
insert(String
The entityName for the entity to be inserted
entityName
,
Object
a new transient instance
entity
)

Implements org.hibernate.StatelessSession.insert.

Insert a row.
public Object
instantiate(String entityName, Object id)

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

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

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

Instantiate the entity class of the given EntityPersister, initializing the new instance with the given identifier.
public Object
internalLoad(String entityName, Object id, boolean eager, boolean nullable)

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

Obtain an entity instance with the given id, without checking if it was deleted or scheduled for deletion.
public boolean
public boolean
isDefaultReadOnly()

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.isDefaultReadOnly.

Are entities and proxies loaded by this session read-only by default?
private boolean
public boolean
public boolean
isTransactionInProgress()

Overrides org.hibernate.internal.AbstractSharedSessionContract.isTransactionInProgress.

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.isTransactionInProgress.

Does this session have an active Hibernate transaction, or is it associated with a JTA transaction currently in progress?
protected Object
private void
private void
public void
refresh(Object
The entity to be refreshed.
entity
)

Implements org.hibernate.StatelessSession.refresh.

Refresh the entity instance state from the database.
public void
refresh(String
The entityName for the entity to be refreshed.
entityName
,
Object
The entity to be refreshed.
entity
)

Implements org.hibernate.StatelessSession.refresh.

Refresh the entity instance state from the database.
public void
refresh(Object
The entity to be refreshed.
entity
,
LockMode
The LockMode to be applied.
lockMode
)

Implements org.hibernate.StatelessSession.refresh.

Refresh the entity instance state from the database.
public void
refresh(String
The entityName for the entity to be refreshed.
entityName
,
Object
The entity to be refreshed.
entity
,
LockMode
The LockMode to be applied.
lockMode
)

Implements org.hibernate.StatelessSession.refresh.

Refresh the entity instance state from the database.
public void
setAutoClear(boolean enabled)

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

Enable or disable automatic cache clearing from after transaction completion.
public void
public void
setDefaultReadOnly(boolean readOnly)

public void
public boolean
shouldAutoClose()

Implements org.hibernate.engine.spi.SharedSessionContractImplementor.shouldAutoClose.

Should this session be automatically closed after the current transaction completes?
public boolean
public void
update(Object
a detached entity instance
entity
)

Implements org.hibernate.StatelessSession.update.

Update a row.
public void
update(String
The entityName for the entity to be updated
entityName
,
Object
a detached entity instance
entity
)

Implements org.hibernate.StatelessSession.update.

Update a row.
public void
upsert(Object
a detached entity instance
entity
)

Implements org.hibernate.StatelessSession.upsert.

Use a SQL merge into statement to perform an upsert.
public void
upsert(String
The entityName for the entity to be merged
entityName
,
Object
a detached entity instance
entity
)

Implements org.hibernate.StatelessSession.upsert.

Use a SQL merge into statement to perform an upsert.
Inherited from org.hibernate.internal.AbstractSharedSessionContract:
accessTransactionaddResultTypeaddSharedSessionTransactionObserverapplyQuerySettingsAndHintsapplyQuerySettingsAndHintsbeginTransactionbuildNamedQuerybuildNamedQuerycheckMutationQuerycheckOpencheckOpenOrWaitingForAutoClosecheckResultTypecheckSelectionQuerycheckTransactionNeededForUpdateOperationcheckTransactionSynchStatuscleanupOnCloseclosecreateEntityGraphcreateEntityGraphcreateEntityGraphcreateMutationQuerycreateMutationQuerycreateMutationQuerycreateMutationQuerycreateNamedMutationQuerycreateNamedQuerycreateNamedQuerycreateNamedSelectionQuerycreateNamedSelectionQuerycreateNamedStoredProcedureQuerycreateNativeMutationQuerycreateNativeQuerycreateNativeQuerycreateNativeQuerycreateNativeQuerycreateNativeQuerycreateNativeQueryImplementorcreateNativeQueryImplementorcreateQuerycreateQuerycreateQuerycreateQuerycreateQuerycreateSelectionQuerycreateSelectionQuerycreateSelectionQuerycreateSqmQueryImplementorcreateSqmQueryImplementorcreateStoredProcedureCallcreateStoredProcedureCallcreateStoredProcedureCallcreateStoredProcedureQuerycreateStoredProcedureQuerycreateStoredProcedureQuerydelayedAfterCompletiondoReturningWorkdoWorkexecutegenerateEntityKeygetCacheTransactionSynchronizationgetConfiguredJdbcBatchSizegetCriteriaBuildergetCurrentTransactiongetEntityGraphgetEntityGraphsgetEntityNameResolvergetEventListenerManagergetEventManagergetExceptionConvertergetFactorygetFlushModegetHibernateFlushModegetInterceptorgetJdbcBatchSizegetJdbcConnectionAccessgetJdbcCoordinatorgetJdbcServicesgetJdbcSessionContextgetJdbcTimeZonegetLobCreatorgetNamedNativeQuerygetNamedNativeQuerygetNamedProcedureCallgetNamedQuerygetNativeJdbcParametersIgnoredgetPreferredSqlTypeCodeForBooleangetResultSetMappingMementogetSessionIdentifiergetSessionTokengetTenantIdentifiergetTenantIdentifierValuegetTransactiongetTransactionCoordinatorinterpretHqlisClosedisConnectedisCriteriaCopyTreeEnabledisJoinedToTransactionisOpenisOpenOrWaitingForAutoClosejoinTransactionmarkForRollbackOnlyprepareForAutoCloseprepareForQueryExecutionpulseTransactionCoordinatorremoveSharedSessionTransactionObserversetClosedsetCriteriaCopyTreeEnabledsetJdbcBatchSizesetNativeJdbcParametersIgnoredsetUpMultitenancyshouldCloseJdbcCoordinatorOnClosestartTransactionBoundaryuseStreamForLobBinding