public class StatelessSessionImpl extends AbstractSessionImpl implements JDBCContext.Context, StatelessSession
factory| Modifier and Type | Method and Description |
|---|---|
void |
afterOperation(boolean success) |
void |
afterScrollOperation() |
void |
afterTransactionBegin(Transaction tx)
We cannot rely upon this method being called! It is only
called if we are using Hibernate Transaction API.
|
void |
afterTransactionCompletion(boolean successful,
Transaction tx)
Notify the session that the transaction completed, so we no longer
own the old locks.
|
void |
applyNonFlushedChanges(NonFlushedChanges nonFlushedChanges)
Apply non-flushed changes from a different session to this session.
|
protected boolean |
autoFlushIfRequired(Set querySpaces) |
void |
beforeTransactionCompletion(Transaction tx)
Notify the session that the transaction is about to complete
|
Transaction |
beginTransaction()
Begin a Hibernate transaction.
|
String |
bestGuessEntityName(Object object)
The best guess entity name for an entity not in an association
|
void |
close()
Close the stateless session and release the JDBC connection.
|
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 a new Criteria instance, for the given entity class,
or a superclass of an entity class.
|
Criteria |
createCriteria(Class persistentClass,
String alias)
Create a new Criteria instance, for the given entity class,
or a superclass of an entity class, with the given alias.
|
Criteria |
createCriteria(String entityName)
Create a new Criteria instance, for the given entity name.
|
Criteria |
createCriteria(String entityName,
String alias)
Create a new Criteria instance, for the given entity name,
with the given 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() |
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.
|
Batcher |
getBatcher()
Get the prepared statement Batcher for this session
|
CacheMode |
getCacheMode() |
ConnectionReleaseMode |
getConnectionReleaseMode() |
Serializable |
getContextEntityIdentifier(Object object)
Return the identifier of the persistent object, or null if
not associated with the session
|
int |
getDontFlushFromFind() |
Map |
getEnabledFilters()
Return the currently enabled filters.
|
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
|
String |
getFetchProfile()
Get the internal fetch profile currently associated with this session.
|
Type |
getFilterParameterType(String filterParameterName)
Retreive the type for a given filter parrameter.
|
Object |
getFilterParameterValue(String filterParameterName)
Retreive the currently set value for a filter parameter.
|
FlushMode |
getFlushMode() |
Interceptor |
getInterceptor()
Retrieves the interceptor currently in use by this event source.
|
JDBCContext |
getJDBCContext() |
EventListeners |
getListeners()
Retrieves the configured event listeners from this event source.
|
LoadQueryInfluencers |
getLoadQueryInfluencers()
Get the load query influencers associated with this session.
|
NonFlushedChanges |
getNonFlushedChanges()
Return changes to this session that have not been flushed yet.
|
PersistenceContext |
getPersistenceContext()
Get the persistence context for this session
|
long |
getTimestamp()
System time before the start of the transaction
|
Transaction |
getTransaction()
Get the current Hibernate transaction.
|
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 |
isConnected() |
boolean |
isDefaultReadOnly() |
boolean |
isEventSource() |
boolean |
isFlushBeforeCompletionEnabled() |
boolean |
isFlushModeNever() |
boolean |
isOpen() |
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(CriteriaImpl 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
|
void |
managedClose() |
void |
managedFlush() |
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.
|
void |
registerInsertedKey(EntityPersister persister,
Serializable id) |
ScrollableResults |
scroll(CriteriaImpl criteria,
ScrollMode scrollMode)
Execute a criteria query
|
ScrollableResults |
scroll(String query,
QueryParameters queryParameters)
Execute a scroll() query
|
ScrollableResults |
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 |
setFetchProfile(String name)
Set the current internal fetch profile for this session.
|
void |
setFlushMode(FlushMode fm) |
boolean |
shouldAutoClose() |
void |
update(Object entity)
Update a row.
|
void |
update(String entityName,
Object entity)
Update a row.
|
boolean |
wasInsertedDuringTransaction(EntityPersister persister,
Serializable id) |
createQuery, createSQLQuery, errorIfClosed, getFactory, getHQLQueryPlan, getNamedQuery, getNamedSQLQuery, getNativeSQLQueryPlan, isClosed, list, scroll, setClosedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetFactory, isClosedcreateQuery, createSQLQuery, getNamedQuerypublic Serializable insert(Object entity)
StatelessSessioninsert in interface StatelessSessionentity - a new transient instancepublic Serializable insert(String entityName, Object entity)
StatelessSessioninsert in interface StatelessSessionentityName - The entityName for the entity to be insertedentity - a new transient instancepublic void delete(Object entity)
StatelessSessiondelete in interface StatelessSessionentity - a detached entity instancepublic void delete(String entityName, Object entity)
StatelessSessiondelete in interface StatelessSessionentityName - The entityName for the entity to be deletedentity - a detached entity instancepublic void update(Object entity)
StatelessSessionupdate in interface StatelessSessionentity - a detached entity instancepublic void update(String entityName, Object entity)
StatelessSessionupdate in interface StatelessSessionentityName - The entityName for the entity to be updatedentity - a detached entity instancepublic Object get(Class entityClass, Serializable id)
StatelessSessionget in interface StatelessSessionpublic Object get(Class entityClass, Serializable id, LockMode lockMode)
StatelessSessionget in interface StatelessSessionpublic Object get(String entityName, Serializable id)
StatelessSessionget in interface StatelessSessionpublic Object get(String entityName, Serializable id, LockMode lockMode)
StatelessSessionget in interface StatelessSessionpublic void refresh(Object entity)
StatelessSessionrefresh in interface StatelessSessionentity - The entity to be refreshed.public void refresh(String entityName, Object entity)
StatelessSessionrefresh in interface StatelessSessionentityName - The entityName for the entity to be refreshed.entity - The entity to be refreshed.public void refresh(Object entity, LockMode lockMode)
StatelessSessionrefresh in interface StatelessSessionentity - The entity to be refreshed.lockMode - The LockMode to be applied.public void refresh(String entityName, Object entity, LockMode lockMode)
StatelessSessionrefresh in interface StatelessSessionentityName - 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
SessionImplementorimmediateLoad in interface SessionImplementorHibernateExceptionpublic void initializeCollection(PersistentCollection collection, boolean writing) throws HibernateException
SessionImplementorinitializeCollection in interface SessionImplementorHibernateExceptionpublic Object instantiate(String entityName, Serializable id) throws HibernateException
SessionImplementorinstantiate in interface SessionImplementorHibernateExceptionpublic Object internalLoad(String entityName, Serializable id, boolean eager, boolean nullable) throws HibernateException
SessionImplementorinternalLoad in interface SessionImplementorHibernateExceptionpublic Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException
SessionImplementoriterate in interface SessionImplementorHibernateExceptionpublic Iterator iterateFilter(Object collection, String filter, QueryParameters queryParameters) throws HibernateException
SessionImplementoriterateFilter in interface SessionImplementorHibernateExceptionpublic List listFilter(Object collection, String filter, QueryParameters queryParameters) throws HibernateException
SessionImplementorlistFilter in interface SessionImplementorHibernateExceptionpublic boolean isOpen()
isOpen in interface SessionImplementorpublic void close()
StatelessSessionclose in interface StatelessSessionpublic ConnectionReleaseMode getConnectionReleaseMode()
getConnectionReleaseMode in interface JDBCContext.Contextpublic boolean isAutoCloseSessionEnabled()
isAutoCloseSessionEnabled in interface JDBCContext.Contextpublic boolean isFlushBeforeCompletionEnabled()
isFlushBeforeCompletionEnabled in interface TransactionFactory.Contextpublic boolean isFlushModeNever()
isFlushModeNever in interface TransactionFactory.Contextpublic void managedClose()
managedClose in interface TransactionFactory.Contextpublic void managedFlush()
managedFlush in interface TransactionFactory.Contextpublic boolean shouldAutoClose()
shouldAutoClose in interface TransactionFactory.Contextpublic void afterTransactionCompletion(boolean successful,
Transaction tx)
SessionImplementorafterTransactionCompletion in interface SessionImplementorafterTransactionCompletion in interface JDBCContext.Contextpublic void beforeTransactionCompletion(Transaction tx)
SessionImplementorbeforeTransactionCompletion in interface SessionImplementorbeforeTransactionCompletion in interface JDBCContext.Contextpublic String bestGuessEntityName(Object object)
SessionImplementorbestGuessEntityName in interface SessionImplementorpublic Connection connection()
StatelessSessionconnection in interface SessionImplementorconnection in interface StatelessSessionpublic int executeUpdate(String query, QueryParameters queryParameters) throws HibernateException
SessionImplementorexecuteUpdate in interface SessionImplementorHibernateExceptionpublic Batcher getBatcher()
SessionImplementorgetBatcher in interface SessionImplementorpublic CacheMode getCacheMode()
getCacheMode in interface SessionImplementorpublic int getDontFlushFromFind()
getDontFlushFromFind in interface SessionImplementorpublic Map getEnabledFilters()
SessionImplementorFilterImpl
instance.getEnabledFilters in interface SessionImplementorpublic Serializable getContextEntityIdentifier(Object object)
SessionImplementorgetContextEntityIdentifier in interface SessionImplementorpublic EntityMode getEntityMode()
getEntityMode in interface SessionImplementorpublic EntityPersister getEntityPersister(String entityName, Object object) throws HibernateException
SessionImplementorgetEntityPersister in interface SessionImplementorentityName - optional entity nameobject - the entity instanceHibernateExceptionpublic Object getEntityUsingInterceptor(EntityKey key) throws HibernateException
SessionImplementorgetEntityUsingInterceptor in interface SessionImplementorHibernateExceptionpublic Type getFilterParameterType(String filterParameterName)
SessionImplementorgetFilterParameterType in interface SessionImplementorfilterParameterName - The filter parameter name in the format
{FILTER_NAME.PARAMETER_NAME}.public Object getFilterParameterValue(String filterParameterName)
SessionImplementorgetFilterParameterValue in interface SessionImplementorfilterParameterName - The filter parameter name in the format
{FILTER_NAME.PARAMETER_NAME}.public FlushMode getFlushMode()
getFlushMode in interface SessionImplementorpublic Interceptor getInterceptor()
SessionImplementorgetInterceptor in interface SessionImplementorpublic EventListeners getListeners()
SessionImplementorgetListeners in interface SessionImplementorpublic PersistenceContext getPersistenceContext()
SessionImplementorgetPersistenceContext in interface SessionImplementorpublic long getTimestamp()
SessionImplementorgetTimestamp in interface SessionImplementorpublic String guessEntityName(Object entity) throws HibernateException
SessionImplementorguessEntityName in interface SessionImplementorHibernateExceptionpublic boolean isConnected()
isConnected in interface SessionImplementorpublic boolean isTransactionInProgress()
SessionImplementorisTransactionInProgress in interface SessionImplementorpublic void setAutoClear(boolean enabled)
SessionImplementorsetAutoClear in interface SessionImplementorpublic void setCacheMode(CacheMode cm)
setCacheMode in interface SessionImplementorpublic void setFlushMode(FlushMode fm)
setFlushMode in interface SessionImplementorpublic Transaction getTransaction() throws HibernateException
StatelessSessiongetTransaction in interface StatelessSessionHibernateExceptionpublic Transaction beginTransaction() throws HibernateException
StatelessSessionbeginTransaction in interface StatelessSessionHibernateExceptionpublic boolean isEventSource()
isEventSource in interface SessionImplementorpublic boolean isDefaultReadOnly()
public void setDefaultReadOnly(boolean readOnly)
throws HibernateException
HibernateExceptionpublic List list(String query, QueryParameters queryParameters) throws HibernateException
SessionImplementorlist in interface SessionImplementorHibernateExceptionpublic void afterOperation(boolean success)
public Criteria createCriteria(Class persistentClass, String alias)
StatelessSessioncreateCriteria in interface StatelessSessionpersistentClass - a class, which is persistent, or has persistent subclassespublic Criteria createCriteria(String entityName, String alias)
StatelessSessioncreateCriteria in interface StatelessSessionpublic Criteria createCriteria(Class persistentClass)
StatelessSessioncreateCriteria in interface StatelessSessionpersistentClass - a class, which is persistent, or has persistent subclassespublic Criteria createCriteria(String entityName)
StatelessSessioncreateCriteria in interface StatelessSessionpublic ScrollableResults scroll(CriteriaImpl criteria, ScrollMode scrollMode)
SessionImplementorscroll in interface SessionImplementorpublic List list(CriteriaImpl criteria) throws HibernateException
SessionImplementorlist in interface SessionImplementorHibernateExceptionpublic List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException
SessionImplementorlistCustomQuery in interface SessionImplementorHibernateExceptionpublic ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException
SessionImplementorscrollCustomQuery in interface SessionImplementorHibernateExceptionpublic ScrollableResults scroll(String query, QueryParameters queryParameters) throws HibernateException
SessionImplementorscroll in interface SessionImplementorHibernateExceptionpublic void afterScrollOperation()
afterScrollOperation in interface SessionImplementorpublic void flush()
flush in interface SessionImplementorpublic NonFlushedChanges getNonFlushedChanges()
SessionImplementorgetNonFlushedChanges in interface SessionImplementorpublic void applyNonFlushedChanges(NonFlushedChanges nonFlushedChanges)
SessionImplementorapplyNonFlushedChanges in interface SessionImplementornonFlushedChanges - the non-flushed changespublic String getFetchProfile()
SessionImplementorgetFetchProfile in interface SessionImplementorpublic JDBCContext getJDBCContext()
getJDBCContext in interface SessionImplementorpublic LoadQueryInfluencers getLoadQueryInfluencers()
SessionImplementorgetLoadQueryInfluencers in interface SessionImplementorpublic void registerInsertedKey(EntityPersister persister, Serializable id)
public boolean wasInsertedDuringTransaction(EntityPersister persister, Serializable id)
public void setFetchProfile(String name)
SessionImplementorsetFetchProfile in interface SessionImplementorname - The internal fetch profile name to usepublic void afterTransactionBegin(Transaction tx)
JDBCContext.ContextafterTransactionBegin in interface JDBCContext.Contextprotected boolean autoFlushIfRequired(Set querySpaces) throws HibernateException
HibernateExceptionpublic int executeNativeUpdate(NativeSQLQuerySpecification nativeSQLQuerySpecification, QueryParameters queryParameters) throws HibernateException
SessionImplementorexecuteNativeUpdate in interface SessionImplementorHibernateExceptionCopyright © 2002-2017 Red Hat Middleware, LLC. All Rights Reserved