public class StatelessSessionImpl extends AbstractSharedSessionContract implements StatelessSession
LobCreationContext.Callback<T>
closed, exceptionConverter, waitingForAutoClose
Modifier and Type | Method and Description |
---|---|
void |
afterOperation(boolean success) |
void |
afterScrollOperation() |
void |
afterTransactionBegin()
A after-begin callback from the coordinator to its owner.
|
void |
afterTransactionCompletion(boolean successful,
boolean delayed)
An after-completion callback to the owner.
|
void |
beforeTransactionCompletion()
A before-completion callback to the owner.
|
String |
bestGuessEntityName(Object object)
The best guess entity name for an entity not in an association
|
Connection |
connection()
Returns the current JDBC connection associated with this
instance.
If the session is using aggressive connection release (as in a CMT environment), it is the application's responsibility to close the connection returned by this call. |
Criteria |
createCriteria(Class persistentClass)
Create
Criteria instance for the given class (entity or subclasses/implementors). |
Criteria |
createCriteria(Class persistentClass,
String alias)
Create
Criteria instance for the given class (entity or subclasses/implementors), using a specific
alias. |
Criteria |
createCriteria(String entityName)
Create
Criteria instance for the given entity name. |
Criteria |
createCriteria(String entityName,
String alias)
Create
Criteria instance for the given entity name, using a specific alias. |
void |
delete(Object entity)
Delete a row.
|
void |
delete(String entityName,
Object entity)
Delete a row.
|
int |
executeNativeUpdate(NativeSQLQuerySpecification nativeSQLQuerySpecification,
QueryParameters queryParameters)
Execute a native SQL update or delete query
|
int |
executeUpdate(String query,
QueryParameters queryParameters)
Execute a HQL update or delete query
|
void |
flush() |
void |
flushBeforeTransactionCompletion() |
Object |
get(Class entityClass,
Serializable id)
Retrieve a row.
|
Object |
get(Class entityClass,
Serializable id,
LockMode lockMode)
Retrieve a row, obtaining the specified lock mode.
|
Object |
get(String entityName,
Serializable id)
Retrieve a row.
|
Object |
get(String entityName,
Serializable id,
LockMode lockMode)
Retrieve a row, obtaining the specified lock mode.
|
CacheMode |
getCacheMode() |
Serializable |
getContextEntityIdentifier(Object object)
Return the identifier of the persistent object, or null if
not associated with the session
|
int |
getDontFlushFromFind() |
EntityMode |
getEntityMode() |
EntityPersister |
getEntityPersister(String entityName,
Object object)
Get the EntityPersister for any instance
|
Object |
getEntityUsingInterceptor(EntityKey key)
Get the entity instance associated with the given Key,
calling the Interceptor if necessary
|
LoadQueryInfluencers |
getLoadQueryInfluencers()
Get the load query influencers associated with this session.
|
PersistenceContext |
getPersistenceContext()
Get the persistence context for this session
|
String |
guessEntityName(Object entity)
The guessed entity name for an entity not in an association
|
Object |
immediateLoad(String entityName,
Serializable id)
Load an instance immediately.
|
void |
initializeCollection(PersistentCollection collection,
boolean writing)
Initialize the collection (if not already initialized)
|
Serializable |
insert(Object entity)
Insert a row.
|
Serializable |
insert(String entityName,
Object entity)
Insert a row.
|
Object |
instantiate(String entityName,
Serializable id)
Instantiate the entity class, initializing with the given identifier
|
Object |
internalLoad(String entityName,
Serializable id,
boolean eager,
boolean nullable)
Load an instance without checking if it was deleted.
|
boolean |
isAutoCloseSessionEnabled() |
boolean |
isDefaultReadOnly() |
boolean |
isEventSource() |
boolean |
isTransactionInProgress()
Does this Session have an active Hibernate transaction
or is there a JTA transaction in progress?
|
Iterator |
iterate(String query,
QueryParameters queryParameters)
Execute an iterate() query
|
Iterator |
iterateFilter(Object collection,
String filter,
QueryParameters queryParameters)
Iterate a filter
|
List |
list(Criteria criteria)
Execute a criteria query
|
List |
list(String query,
QueryParameters queryParameters)
Execute a find() query
|
List |
listCustomQuery(CustomQuery customQuery,
QueryParameters queryParameters)
Execute an SQL Query
|
List |
listFilter(Object collection,
String filter,
QueryParameters queryParameters)
Execute a filter
|
protected Object |
load(String entityName,
Serializable identifier) |
void |
refresh(Object entity)
Refresh the entity instance state from the database.
|
void |
refresh(Object entity,
LockMode lockMode)
Refresh the entity instance state from the database.
|
void |
refresh(String entityName,
Object entity)
Refresh the entity instance state from the database.
|
void |
refresh(String entityName,
Object entity,
LockMode lockMode)
Refresh the entity instance state from the database.
|
ScrollableResultsImplementor |
scroll(Criteria criteria,
ScrollMode scrollMode)
Execute a criteria query
|
ScrollableResultsImplementor |
scroll(String query,
QueryParameters queryParameters)
Execute a scroll() query
|
ScrollableResultsImplementor |
scrollCustomQuery(CustomQuery customQuery,
QueryParameters queryParameters)
Execute an SQL Query
|
void |
setAutoClear(boolean enabled)
Enable/disable automatic cache clearing from after transaction
completion (for EJB3)
|
void |
setCacheMode(CacheMode cm) |
void |
setDefaultReadOnly(boolean readOnly) |
void |
setFlushMode(FlushMode fm)
Set the flush mode for this session.
|
void |
setHibernateFlushMode(FlushMode flushMode)
Set the flush mode for this session.
|
boolean |
shouldAutoClose() |
boolean |
shouldAutoJoinTransaction()
Indicates whether an active transaction should be automatically joined.
|
void |
update(Object entity)
Update a row.
|
void |
update(String entityName,
Object entity)
Update a row.
|
accessTransaction, addSharedSessionTransactionObserver, applyQuerySettingsAndHints, beginTransaction, buildQueryFromName, checkOpen, checkOpenOrWaitingForAutoClose, checkTransactionSynchStatus, cleanupOnClose, close, createNamedQuery, createNamedQuery, createNativeQuery, createNativeQuery, createNativeQuery, createNativeQuery, createQuery, createQuery, createQuery, createQuery, createSQLQuery, createStoredProcedureCall, createStoredProcedureCall, createStoredProcedureCall, delayedAfterCompletion, errorIfClosed, execute, generateEntityKey, getCacheTransactionSynchronization, getCurrentTransaction, getEntityNameResolver, getEventListenerManager, getExceptionConverter, getFactory, getFlushMode, getHibernateFlushMode, getInterceptor, getJdbcBatchSize, getJdbcConnectionAccess, getJdbcCoordinator, getJdbcServices, getJdbcSessionContext, getJdbcTimeZone, getLobCreator, getNamedNativeQuery, getNamedProcedureCall, getNamedQuery, getNamedSQLQuery, getNativeQueryImplementor, getNativeQueryPlan, getQueryPlan, getSessionIdentifier, getTenantIdentifier, getTransaction, getTransactionCoordinator, getTransactionStartTimestamp, initQueryFromNamedDefinition, isClosed, isConnected, isOpen, isOpenOrWaitingForAutoClose, list, markForRollbackOnly, pulseTransactionCoordinator, remapSqlTypeDescriptor, removeSharedSessionTransactionObserver, resultClassChecking, resultClassChecking, scroll, setClosed, setJdbcBatchSize, shouldCloseJdbcCoordinatorOnClose, startTransactionBoundary, useStreamForLobBinding
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
beginTransaction, createStoredProcedureCall, createStoredProcedureCall, createStoredProcedureCall, getJdbcBatchSize, getNamedProcedureCall, getTenantIdentifier, getTransaction, isConnected, isOpen, setJdbcBatchSize
createNamedQuery, createNamedQuery, createNativeQuery, createNativeQuery, createNativeQuery, createQuery, createQuery, createSQLQuery, getNamedNativeQuery, getNamedQuery, getNamedSQLQuery
checkOpen, getConfiguredJdbcBatchSize, getTimestamp, isQueryParametersValidationEnabled
public boolean shouldAutoJoinTransaction()
TransactionCoordinatorBuilder.Options
shouldAutoJoinTransaction
in interface TransactionCoordinatorBuilder.Options
shouldAutoJoinTransaction
in class AbstractSharedSessionContract
true
indicates the active transaction should be auto joined; false
indicates it should not (until TransactionCoordinator.explicitJoin()
is called).public Serializable insert(Object entity)
StatelessSession
insert
in interface StatelessSession
entity
- a new transient instancepublic Serializable insert(String entityName, Object entity)
StatelessSession
insert
in interface StatelessSession
entityName
- The entityName for the entity to be insertedentity
- a new transient instancepublic void delete(Object entity)
StatelessSession
delete
in interface StatelessSession
entity
- a detached entity instancepublic void delete(String entityName, Object entity)
StatelessSession
delete
in interface StatelessSession
entityName
- The entityName for the entity to be deletedentity
- a detached entity instancepublic void update(Object entity)
StatelessSession
update
in interface StatelessSession
entity
- a detached entity instancepublic void update(String entityName, Object entity)
StatelessSession
update
in interface StatelessSession
entityName
- The entityName for the entity to be updatedentity
- a detached entity instancepublic Object get(Class entityClass, Serializable id)
StatelessSession
get
in interface StatelessSession
entityClass
- The class of the entity to retrieveid
- The id of the entity to retrievepublic Object get(Class entityClass, Serializable id, LockMode lockMode)
StatelessSession
get
in interface StatelessSession
entityClass
- The class of the entity to retrieveid
- The id of the entity to retrievelockMode
- The lock mode to apply to the entitypublic Object get(String entityName, Serializable id)
StatelessSession
get
in interface StatelessSession
entityName
- The name of the entity to retrieveid
- The id of the entity to retrievepublic Object get(String entityName, Serializable id, LockMode lockMode)
StatelessSession
get
in interface StatelessSession
entityName
- The name of the entity to retrieveid
- The id of the entity to retrievelockMode
- The lock mode to apply to the entitypublic void refresh(Object entity)
StatelessSession
refresh
in interface StatelessSession
entity
- The entity to be refreshed.public void refresh(String entityName, Object entity)
StatelessSession
refresh
in interface StatelessSession
entityName
- The entityName for the entity to be refreshed.entity
- The entity to be refreshed.public void refresh(Object entity, LockMode lockMode)
StatelessSession
refresh
in interface StatelessSession
entity
- The entity to be refreshed.lockMode
- The LockMode to be applied.public void refresh(String entityName, Object entity, LockMode lockMode)
StatelessSession
refresh
in interface StatelessSession
entityName
- The entityName for the entity to be refreshed.entity
- The entity to be refreshed.lockMode
- The LockMode to be applied.public Object immediateLoad(String entityName, Serializable id) throws HibernateException
SharedSessionContractImplementor
immediateLoad
in interface SharedSessionContractImplementor
HibernateException
public void initializeCollection(PersistentCollection collection, boolean writing) throws HibernateException
SharedSessionContractImplementor
initializeCollection
in interface SharedSessionContractImplementor
HibernateException
public Object instantiate(String entityName, Serializable id) throws HibernateException
SharedSessionContractImplementor
instantiate
in interface SharedSessionContractImplementor
HibernateException
public Object internalLoad(String entityName, Serializable id, boolean eager, boolean nullable) throws HibernateException
SharedSessionContractImplementor
internalLoad
in interface SharedSessionContractImplementor
HibernateException
public Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException
SharedSessionContractImplementor
iterate
in interface SharedSessionContractImplementor
HibernateException
public Iterator iterateFilter(Object collection, String filter, QueryParameters queryParameters) throws HibernateException
SharedSessionContractImplementor
iterateFilter
in interface SharedSessionContractImplementor
HibernateException
public List listFilter(Object collection, String filter, QueryParameters queryParameters) throws HibernateException
SharedSessionContractImplementor
listFilter
in interface SharedSessionContractImplementor
HibernateException
public boolean isAutoCloseSessionEnabled()
isAutoCloseSessionEnabled
in interface SharedSessionContractImplementor
public boolean shouldAutoClose()
shouldAutoClose
in interface SharedSessionContractImplementor
public String bestGuessEntityName(Object object)
SharedSessionContractImplementor
bestGuessEntityName
in interface SharedSessionContractImplementor
public Connection connection()
StatelessSession
connection
in interface SharedSessionContractImplementor
connection
in interface StatelessSession
public int executeUpdate(String query, QueryParameters queryParameters) throws HibernateException
SharedSessionContractImplementor
executeUpdate
in interface SharedSessionContractImplementor
HibernateException
public CacheMode getCacheMode()
getCacheMode
in interface SharedSessionContractImplementor
getCacheMode
in interface QueryProducerImplementor
getCacheMode
in class AbstractSharedSessionContract
public void setCacheMode(CacheMode cm)
setCacheMode
in interface SharedSessionContractImplementor
setCacheMode
in class AbstractSharedSessionContract
public void setFlushMode(FlushMode fm)
SharedSessionContractImplementor
FlushMode.MANUAL
at the start of the session (in
order to achieve some extra performance).setFlushMode
in interface SharedSessionContractImplementor
setFlushMode
in class AbstractSharedSessionContract
fm
- the new flush modepublic void setHibernateFlushMode(FlushMode flushMode)
SharedSessionContractImplementor
FlushMode.MANUAL
at the start of the session (in
order to achieve some extra performance).setHibernateFlushMode
in interface SharedSessionContractImplementor
setHibernateFlushMode
in class AbstractSharedSessionContract
flushMode
- the new flush modepublic int getDontFlushFromFind()
getDontFlushFromFind
in interface SharedSessionContractImplementor
public Serializable getContextEntityIdentifier(Object object)
SharedSessionContractImplementor
getContextEntityIdentifier
in interface SharedSessionContractImplementor
public EntityMode getEntityMode()
public String guessEntityName(Object entity) throws HibernateException
SharedSessionContractImplementor
guessEntityName
in interface SharedSessionContractImplementor
HibernateException
public EntityPersister getEntityPersister(String entityName, Object object) throws HibernateException
SharedSessionContractImplementor
getEntityPersister
in interface SharedSessionContractImplementor
entityName
- optional entity nameobject
- the entity instanceHibernateException
public Object getEntityUsingInterceptor(EntityKey key) throws HibernateException
SharedSessionContractImplementor
getEntityUsingInterceptor
in interface SharedSessionContractImplementor
HibernateException
public PersistenceContext getPersistenceContext()
SharedSessionContractImplementor
getPersistenceContext
in interface SharedSessionContractImplementor
public void setAutoClear(boolean enabled)
SharedSessionContractImplementor
setAutoClear
in interface SharedSessionContractImplementor
protected Object load(String entityName, Serializable identifier)
load
in class AbstractSharedSessionContract
public boolean isEventSource()
isEventSource
in interface SharedSessionContractImplementor
public boolean isDefaultReadOnly()
public void setDefaultReadOnly(boolean readOnly) throws HibernateException
HibernateException
public List list(String query, QueryParameters queryParameters) throws HibernateException
SharedSessionContractImplementor
list
in interface SharedSessionContractImplementor
HibernateException
public void afterOperation(boolean success)
public Criteria createCriteria(Class persistentClass, String alias)
SharedSessionContract
Criteria
instance for the given class (entity or subclasses/implementors), using a specific
alias.createCriteria
in interface SharedSessionContract
persistentClass
- The class, which is an entity, or has entity subclasses/implementorsalias
- The alias to usepublic Criteria createCriteria(String entityName, String alias)
SharedSessionContract
Criteria
instance for the given entity name, using a specific alias.createCriteria
in interface SharedSessionContract
entityName
- The entity namealias
- The alias to usepublic Criteria createCriteria(Class persistentClass)
SharedSessionContract
Criteria
instance for the given class (entity or subclasses/implementors).createCriteria
in interface SharedSessionContract
persistentClass
- The class, which is an entity, or has entity subclasses/implementorspublic Criteria createCriteria(String entityName)
SharedSessionContract
Criteria
instance for the given entity name.createCriteria
in interface SharedSessionContract
entityName
- The entity namepublic ScrollableResultsImplementor scroll(Criteria criteria, ScrollMode scrollMode)
SharedSessionContractImplementor
scroll
in interface SharedSessionContractImplementor
public List list(Criteria criteria) throws HibernateException
SharedSessionContractImplementor
list
in interface SharedSessionContractImplementor
HibernateException
public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException
SharedSessionContractImplementor
listCustomQuery
in interface SharedSessionContractImplementor
HibernateException
public ScrollableResultsImplementor scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException
SharedSessionContractImplementor
scrollCustomQuery
in interface SharedSessionContractImplementor
HibernateException
public ScrollableResultsImplementor scroll(String query, QueryParameters queryParameters) throws HibernateException
SharedSessionContractImplementor
scroll
in interface SharedSessionContractImplementor
HibernateException
public void afterScrollOperation()
afterScrollOperation
in interface SharedSessionContractImplementor
public void flush()
flush
in interface SharedSessionContractImplementor
public LoadQueryInfluencers getLoadQueryInfluencers()
SharedSessionContractImplementor
getLoadQueryInfluencers
in interface SharedSessionContractImplementor
public int executeNativeUpdate(NativeSQLQuerySpecification nativeSQLQuerySpecification, QueryParameters queryParameters) throws HibernateException
SharedSessionContractImplementor
executeNativeUpdate
in interface SharedSessionContractImplementor
HibernateException
public void afterTransactionBegin()
JdbcSessionOwner
afterTransactionBegin
in interface JdbcSessionOwner
public void beforeTransactionCompletion()
JdbcSessionOwner
beforeTransactionCompletion
in interface JdbcSessionOwner
beforeTransactionCompletion
in class AbstractSharedSessionContract
public void afterTransactionCompletion(boolean successful, boolean delayed)
JdbcSessionOwner
afterTransactionCompletion
in interface JdbcSessionOwner
afterTransactionCompletion
in class AbstractSharedSessionContract
successful
- Was the transaction successful?delayed
- Is this a delayed after transaction completion call (aka after a timeout)?public boolean isTransactionInProgress()
SharedSessionContractImplementor
isTransactionInProgress
in interface SharedSessionContractImplementor
isTransactionInProgress
in class AbstractSharedSessionContract
public void flushBeforeTransactionCompletion()
flushBeforeTransactionCompletion
in interface JdbcSessionOwner
Copyright © 2019 JBoss by Red Hat. All rights reserved.