public final class SessionImpl extends AbstractSessionImpl implements EventSource, Session, JDBCContext.Context, LobCreationContext
Session.LockRequestLobCreationContext.Callbackfactory| Modifier and Type | Method and Description |
|---|---|
void |
afterOperation(boolean 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
|
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 success,
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)
detect in-memory changes, determine if the changes are to tables
named in the query and, if so, complete execution the flush
|
void |
beforeTransactionCompletion(Transaction tx)
Notify the session that the transaction is about to complete
|
Transaction |
beginTransaction()
Begin a unit of work and return the associated Transaction object.
|
String |
bestGuessEntityName(Object object)
The best guess entity name for an entity not in an association
|
Session.LockRequest |
buildLockRequest(LockOptions lockOptions)
Build a LockRequest that specifies the LockMode, pessimistic lock timeout and lock scope.
|
void |
cancelQuery()
Cancel the execution of the current query.
|
void |
clear()
Completely clear the session.
|
Connection |
close()
End the session by releasing the JDBC connection and cleaning up.
|
Connection |
connection()
Get the JDBC connection of this Session.
If the session is using aggressive collection release (as in a CMT environment), it is the application's responsibility to close the connection returned by this call. |
boolean |
contains(Object object)
Check if this instance is associated with this Session.
|
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.
|
Query |
createFilter(Object collection,
String queryString)
Create a new instance of Query for the given collection and filter string.
|
Query |
createQuery(String queryString)
Create a new instance of Query for the given HQL query string.
|
SQLQuery |
createSQLQuery(String sql)
Create a new instance of SQLQuery for the given SQL query string.
|
Query |
createSQLQuery(String sql,
String[] returnAliases,
Class[] returnClasses)
Create a new instance of Query for the given SQL string.
|
Query |
createSQLQuery(String sql,
String returnAlias,
Class returnClass)
Create a new instance of Query for the given SQL string.
|
void |
delete(Object object)
Delete a persistent object
|
int |
delete(String query)
Delete all objects returned by the query.
|
void |
delete(String entityName,
Object object)
Delete a persistent object (by explicit entity name)
|
int |
delete(String query,
Object[] values,
Type[] types)
Delete all objects returned by the query.
|
void |
delete(String entityName,
Object object,
boolean isCascadeDeleteEnabled,
Set transientEntities)
Delete a persistent object
|
int |
delete(String query,
Object value,
Type type)
Delete all objects returned by the query.
|
void |
disableFetchProfile(String name)
Disable a particular fetch profile on this session.
|
void |
disableFilter(String filterName)
Disable the named filter for the current session.
|
Connection |
disconnect()
Disconnect the Session from the current JDBC connection.
|
void |
doWork(Work work)
Controller for allowing users to perform JDBC related work using the Connection
managed by this Session.
|
void |
enableFetchProfile(String name)
Enable a particular fetch profile on this session.
|
Filter |
enableFilter(String filterName)
Enable the named filter for this current session.
|
void |
evict(Object object)
remove any hard references to the entity that are held by the infrastructure
(references held by application or other persistant instances are okay)
|
Object |
execute(LobCreationContext.Callback callback)
Execute the given callback, making sure it has access to a viable JDBC
Connection. |
int |
executeNativeUpdate(NativeSQLQuerySpecification nativeQuerySpecification,
QueryParameters queryParameters)
Execute a native SQL update or delete query
|
int |
executeUpdate(String query,
QueryParameters queryParameters)
Execute a HQL update or delete query
|
Collection |
filter(Object collection,
String filter)
Apply a filter to a persistent collection.
|
Collection |
filter(Object collection,
String filter,
Object[] values,
Type[] types)
Apply a filter to a persistent collection.
|
Collection |
filter(Object collection,
String filter,
Object value,
Type type)
Apply a filter to a persistent collection.
|
List |
find(String query)
Retrieve a list of persistent objects using a hibernate query
|
List |
find(String query,
Object[] values,
Type[] types)
Execute a query with bind parameters, binding an array of values to "?"
parameters in the query string.
|
List |
find(String query,
Object value,
Type type)
Execute a query with bind parameters, binding a value to a "?" parameter
in the query string.
|
void |
flush()
Force this session to flush.
|
void |
forceFlush(EntityEntry entityEntry)
Force an immediate flush
|
Object |
get(Class entityClass,
Serializable id)
Return the persistent instance of the given entity class with the given identifier,
or null if there is no such persistent instance.
|
Object |
get(Class entityClass,
Serializable id,
LockMode lockMode)
Return the persistent instance of the given entity class with the given identifier,
or null if there is no such persistent instance.
|
Object |
get(Class entityClass,
Serializable id,
LockOptions lockOptions)
Return the persistent instance of the given entity class with the given identifier,
or null if there is no such persistent instance.
|
Object |
get(String entityName,
Serializable id)
Return the persistent instance of the given named entity with the given identifier,
or null if there is no such persistent instance.
|
Object |
get(String entityName,
Serializable id,
LockMode lockMode)
Return the persistent instance of the given entity class with the given identifier,
or null if there is no such persistent instance.
|
Object |
get(String entityName,
Serializable id,
LockOptions lockOptions)
Return the persistent instance of the given entity class with the given identifier,
or null if there is no such persistent instance.
|
ActionQueue |
getActionQueue()
Get the ActionQueue for this session
|
Batcher |
getBatcher()
Get the prepared statement Batcher for this session
|
CacheMode |
getCacheMode()
Get the current cache mode.
|
ConnectionReleaseMode |
getConnectionReleaseMode() |
Serializable |
getContextEntityIdentifier(Object object)
Get the id value for an object that is actually associated with the session.
|
LockMode |
getCurrentLockMode(Object object)
Determine the current lock mode of the given object.
|
int |
getDontFlushFromFind() |
Filter |
getEnabledFilter(String filterName)
Retrieve a currently enabled filter by name.
|
Map |
getEnabledFilters()
Return the currently enabled filters.
|
EntityMode |
getEntityMode()
Retrieve the entity mode in effect for this session.
|
String |
getEntityName(Object object)
Return the entity name for a persistent entity
|
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()
Get the current flush mode for this session.
|
Serializable |
getIdentifier(Object object)
Return the identifier value of the given entity as associated with this
session.
|
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.
|
LobHelper |
getLobHelper()
Retrieve this session's helper/delegate for creating LOB instances.
|
Query |
getNamedQuery(String queryName)
Get a Query instance for a named query or named native SQL query
|
NonFlushedChanges |
getNonFlushedChanges()
Return changes to this session and its child sessions that have not been flushed yet.
|
PersistenceContext |
getPersistenceContext()
Get the persistence context for this session
|
Session |
getSession(EntityMode entityMode)
Starts a new Session with the given entity mode in effect.
|
SessionFactory |
getSessionFactory()
Get the session factory which created this session.
|
SessionStatistics |
getStatistics()
Get the statistics for this session.
|
long |
getTimestamp()
System time before the start of the transaction
|
Transaction |
getTransaction()
Get the Transaction instance associated with this session.
|
TypeHelper |
getTypeHelper()
Convenience access to the
TypeHelper associated with this session's SessionFactory. |
String |
guessEntityName(Object object)
The guessed entity name for an entity not in an association
|
Object |
immediateLoad(String entityName,
Serializable id)
Load the data for the object with the specified id into a newly created object.
|
void |
initializeCollection(PersistentCollection collection,
boolean writing)
Initialize the collection (if not already initialized)
|
Object |
instantiate(EntityPersister persister,
Serializable id)
give the interceptor an opportunity to override the default instantiation
|
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()
Check if the session is currently connected.
|
boolean |
isDefaultReadOnly()
Will entities and proxies that are loaded into this session be made
read-only by default?
To determine the read-only/modifiable setting for a particular entity
or proxy:
|
boolean |
isDirty()
Does this session contain any changes which must be synchronized with
the database? In other words, would any DML operations be executed if
we flushed this session?
|
boolean |
isEventSource() |
boolean |
isFetchProfileEnabled(String name)
Is a particular fetch profile enabled on this session?
|
boolean |
isFlushBeforeCompletionEnabled() |
boolean |
isFlushModeNever() |
boolean |
isOpen()
Check if the session is still open.
|
boolean |
isReadOnly(Object entityOrProxy)
Is the specified entity or proxy read-only?
To get the default read-only/modifiable setting used for
entities and proxies that are loaded into the session:
|
boolean |
isTransactionInProgress()
Does this Session have an active Hibernate transaction
or is there a JTA transaction in progress?
|
Iterator |
iterate(String query)
Execute a query and return the results in an iterator.
|
Iterator |
iterate(String query,
Object[] values,
Type[] types)
Execute a query and return the results in an iterator.
|
Iterator |
iterate(String query,
Object value,
Type type)
Execute a query and return the results in an iterator.
|
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
|
Object |
load(Class entityClass,
Serializable id)
Return the persistent instance of the given entity class with the given identifier,
assuming that the instance exists.
|
Object |
load(Class entityClass,
Serializable id,
LockMode lockMode)
Return the persistent instance of the given entity class with the given identifier,
obtaining the specified lock mode, assuming the instance exists.
|
Object |
load(Class entityClass,
Serializable id,
LockOptions lockOptions)
Return the persistent instance of the given entity class with the given identifier,
obtaining the specified lock mode, assuming the instance exists.
|
void |
load(Object object,
Serializable id)
Read the persistent state associated with the given identifier into the given transient
instance.
|
Object |
load(String entityName,
Serializable id)
Return the persistent instance of the given entity class with the given identifier,
assuming that the instance exists.
|
Object |
load(String entityName,
Serializable id,
LockMode lockMode)
Return the persistent instance of the given entity class with the given identifier,
obtaining the specified lock mode, assuming the instance exists.
|
Object |
load(String entityName,
Serializable id,
LockOptions lockOptions)
Return the persistent instance of the given entity class with the given identifier,
obtaining the specified lock mode, assuming the instance exists.
|
void |
lock(Object object,
LockMode lockMode)
Obtain the specified lock level upon the given object.
|
void |
lock(String entityName,
Object object,
LockMode lockMode)
Obtain the specified lock level upon the given object.
|
void |
managedClose() |
void |
managedFlush() |
Object |
merge(Object object)
Copy the state of the given object onto the persistent object with the same
identifier.
|
Object |
merge(String entityName,
Object object)
Copy the state of the given object onto the persistent object with the same
identifier.
|
void |
merge(String entityName,
Object object,
Map copiedAlready)
Cascade merge an entity instance
|
void |
persist(Object object)
Make a transient instance persistent.
|
void |
persist(String entityName,
Object object)
Make a transient instance persistent.
|
void |
persist(String entityName,
Object object,
Map copiedAlready)
Cascade persist an entity instance
|
void |
persistOnFlush(Object object) |
void |
persistOnFlush(String entityName,
Object object) |
void |
persistOnFlush(String entityName,
Object object,
Map copiedAlready)
Cascade persist an entity instance during the flush process
|
void |
reconnect()
Obtain a new JDBC connection.
|
void |
reconnect(Connection conn)
Reconnect to the given JDBC connection.
|
void |
refresh(Object object)
Re-read the state of the given instance from the underlying database.
|
void |
refresh(Object object,
LockMode lockMode)
Re-read the state of the given instance from the underlying database, with
the given LockMode.
|
void |
refresh(Object object,
LockOptions lockOptions)
Re-read the state of the given instance from the underlying database, with
the given LockMode.
|
void |
refresh(Object object,
Map refreshedAlready)
Cascade refesh an entity instance
|
void |
replicate(Object obj,
ReplicationMode replicationMode)
Persist the state of the given detached instance, reusing the current
identifier value.
|
void |
replicate(String entityName,
Object obj,
ReplicationMode replicationMode)
Persist the state of the given detached instance, reusing the current
identifier value.
|
Serializable |
save(Object obj)
Persist the given transient instance, first assigning a generated identifier.
|
void |
save(Object obj,
Serializable id)
Persist the given transient instance, using the given identifier.
|
Serializable |
save(String entityName,
Object object)
Persist the given transient instance, first assigning a generated identifier.
|
void |
save(String entityName,
Object object,
Serializable id)
Persist the given transient instance, using the given identifier.
|
void |
saveOrUpdate(Object object)
Either
Session.save(Object) or Session.update(Object) the given
instance, depending upon resolution of the unsaved-value checks (see the
manual for discussion of unsaved-value checking). |
void |
saveOrUpdate(String entityName,
Object obj)
Either
Session.save(String, Object) or Session.update(String, Object)
the given instance, depending upon resolution of the unsaved-value checks
(see the manual for discussion of unsaved-value checking). |
Object |
saveOrUpdateCopy(Object object)
Copy the state of the given object onto the persistent object with the same
identifier.
|
Object |
saveOrUpdateCopy(Object object,
Serializable id)
Copy the state of the given object onto the persistent object with the
given identifier.
|
Object |
saveOrUpdateCopy(String entityName,
Object object)
Copy the state of the given object onto the persistent object with the same
identifier.
|
void |
saveOrUpdateCopy(String entityName,
Object object,
Map copiedAlready)
Cascade copy an entity instance
|
Object |
saveOrUpdateCopy(String entityName,
Object object,
Serializable id)
Copy the state of the given object onto the persistent object with the
given identifier.
|
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 cacheMode)
Set the cache mode.
|
void |
setDefaultReadOnly(boolean defaultReadOnly)
Change the default for entities and proxies loaded into this session
from modifiable to read-only mode, or from modifiable to read-only mode.
|
void |
setFetchProfile(String fetchProfile)
Set the current internal fetch profile for this session.
|
void |
setFlushMode(FlushMode flushMode)
Set the flush mode for this session.
|
void |
setReadOnly(Object entity,
boolean readOnly)
Set an unmodified persistent object to read-only mode, or a read-only
object to modifiable mode.
|
boolean |
shouldAutoClose() |
String |
toString() |
void |
update(Object obj)
Update the persistent instance with the identifier of the given detached
instance.
|
void |
update(Object obj,
Serializable id)
Update the persistent state associated with the given identifier.
|
void |
update(String entityName,
Object object)
Update the persistent instance with the identifier of the given detached
instance.
|
void |
update(String entityName,
Object object,
Serializable id)
Update the persistent state associated with the given identifier.
|
errorIfClosed, getFactory, getHQLQueryPlan, getNamedSQLQuery, getNativeSQLQueryPlan, isClosed, list, scroll, setClosedclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetFactory, getNamedSQLQuery, isClosed, list, scrollgetFactory, isClosedpublic Session getSession(EntityMode entityMode)
SessiongetSession in interface SessionentityMode - The entity mode to use for the new session.public void clear()
Sessionpublic Batcher getBatcher()
SessionImplementorgetBatcher in interface SessionImplementorpublic long getTimestamp()
SessionImplementorgetTimestamp in interface SessionImplementorpublic Connection close() throws HibernateException
SessionSession.disconnect() it.close in interface SessionHibernateException - Indicates problems cleaning up.public ConnectionReleaseMode getConnectionReleaseMode()
getConnectionReleaseMode in interface JDBCContext.Contextpublic boolean isAutoCloseSessionEnabled()
isAutoCloseSessionEnabled in interface JDBCContext.Contextpublic boolean isOpen()
SessionisOpen in interface SessionImplementorisOpen in interface Sessionpublic boolean isFlushModeNever()
isFlushModeNever in interface TransactionFactory.Contextpublic boolean isFlushBeforeCompletionEnabled()
isFlushBeforeCompletionEnabled in interface TransactionFactory.Contextpublic void managedFlush()
managedFlush in interface TransactionFactory.Contextpublic NonFlushedChanges getNonFlushedChanges() throws HibernateException
getNonFlushedChanges in interface SessionImplementorHibernateExceptionpublic void applyNonFlushedChanges(NonFlushedChanges nonFlushedChanges) throws HibernateException
applyNonFlushedChanges in interface SessionImplementornonFlushedChanges - the non-flushed changesHibernateExceptionpublic boolean shouldAutoClose()
shouldAutoClose in interface TransactionFactory.Contextpublic void managedClose()
managedClose in interface TransactionFactory.Contextpublic Connection connection() throws HibernateException
Sessionconnection in interface SessionImplementorconnection in interface SessionHibernateException - if the Session is disconnectedpublic boolean isConnected()
SessionisConnected in interface SessionImplementorisConnected in interface Sessionpublic boolean isTransactionInProgress()
SessionImplementorisTransactionInProgress in interface SessionImplementorpublic Connection disconnect() throws HibernateException
SessionConnectionProvider has no effect,
provided ConnectionReleaseMode.ON_CLOSE is not in effect.disconnect in interface SessionHibernateExceptionSession.reconnect(Connection),
Session.reconnect()public void reconnect()
throws HibernateException
Sessionreconnect in interface SessionHibernateExceptionSession.disconnect()public void reconnect(Connection conn) throws HibernateException
Sessionreconnect in interface Sessionconn - a JDBC connectionHibernateExceptionSession.disconnect()public void beforeTransactionCompletion(Transaction tx)
SessionImplementorbeforeTransactionCompletion in interface SessionImplementorbeforeTransactionCompletion in interface JDBCContext.Contextpublic void setAutoClear(boolean enabled)
SessionImplementorsetAutoClear in interface SessionImplementorpublic void afterOperation(boolean success)
public void afterTransactionCompletion(boolean success,
Transaction tx)
SessionImplementorafterTransactionCompletion in interface SessionImplementorafterTransactionCompletion in interface JDBCContext.Contextpublic LockMode getCurrentLockMode(Object object) throws HibernateException
SessiongetCurrentLockMode in interface Sessionobject - a persistent instanceHibernateExceptionpublic Object getEntityUsingInterceptor(EntityKey key) throws HibernateException
SessionImplementorgetEntityUsingInterceptor in interface SessionImplementorHibernateExceptionpublic void saveOrUpdate(Object object) throws HibernateException
SessionSession.save(Object) or Session.update(Object) the given
instance, depending upon resolution of the unsaved-value checks (see the
manual for discussion of unsaved-value checking).
This operation cascades to associated instances if the association is mapped
with cascade="save-update".saveOrUpdate in interface Sessionobject - a transient or detached instance containing new or updated stateHibernateExceptionSession.save(java.lang.Object),
Session.update(Object object)public void saveOrUpdate(String entityName, Object obj) throws HibernateException
SessionSession.save(String, Object) or Session.update(String, Object)
the given instance, depending upon resolution of the unsaved-value checks
(see the manual for discussion of unsaved-value checking).
This operation cascades to associated instances if the association is mapped
with cascade="save-update".saveOrUpdate in interface Sessionobj - a transient or detached instance containing new or updated stateHibernateExceptionSession.save(String,Object),
Session.update(String,Object)public void save(Object obj, Serializable id) throws HibernateException
Sessionobj - a transient instance of a persistent classid - an unused valid identifierHibernateExceptionpublic Serializable save(Object obj) throws HibernateException
Sessionsave in interface Sessionobj - a transient instance of a persistent classHibernateExceptionpublic Serializable save(String entityName, Object object) throws HibernateException
Sessionsave in interface Sessionobject - a transient instance of a persistent classHibernateExceptionpublic void save(String entityName, Object object, Serializable id) throws HibernateException
Sessionobject - a transient instance of a persistent classid - an unused valid identifierHibernateExceptionpublic void update(Object obj) throws HibernateException
Sessionupdate in interface Sessionobj - a detached instance containing updated stateHibernateExceptionpublic void update(Object obj, Serializable id) throws HibernateException
Sessionobj - a detached instance containing updated stateid - identifier of persistent instanceHibernateExceptionpublic void update(String entityName, Object object) throws HibernateException
Sessionupdate in interface Sessionobject - a detached instance containing updated stateHibernateExceptionpublic void update(String entityName, Object object, Serializable id) throws HibernateException
Sessionobject - a detached instance containing updated stateid - identifier of persistent instanceHibernateExceptionpublic void lock(String entityName, Object object, LockMode lockMode) throws HibernateException
Sessionlock in interface Sessionobject - a persistent or transient instancelockMode - the lock levelHibernateExceptionpublic Session.LockRequest buildLockRequest(LockOptions lockOptions)
SessionbuildLockRequest in interface SessionlockOptions - contains the lock levelpublic void lock(Object object, LockMode lockMode) throws HibernateException
Sessionlock in interface Sessionobject - a persistent or transient instancelockMode - the lock levelHibernateExceptionpublic void persist(String entityName, Object object) throws HibernateException
Sessionpersist in interface Sessionobject - a transient instance to be made persistentHibernateExceptionpublic void persist(Object object) throws HibernateException
Sessionpersist in interface Sessionobject - a transient instance to be made persistentHibernateExceptionpublic void persist(String entityName, Object object, Map copiedAlready) throws HibernateException
EventSourcepersist in interface EventSourceHibernateExceptionpublic void persistOnFlush(String entityName, Object object) throws HibernateException
HibernateExceptionpublic void persistOnFlush(Object object) throws HibernateException
HibernateExceptionpublic void persistOnFlush(String entityName, Object object, Map copiedAlready) throws HibernateException
EventSourcepersistOnFlush in interface EventSourceHibernateExceptionpublic Object merge(String entityName, Object object) throws HibernateException
Sessionmerge in interface Sessionobject - a detached instance with state to be copiedHibernateExceptionpublic Object merge(Object object) throws HibernateException
Sessionmerge in interface Sessionobject - a detached instance with state to be copiedHibernateExceptionpublic void merge(String entityName, Object object, Map copiedAlready) throws HibernateException
EventSourcemerge in interface EventSourceHibernateExceptionpublic Object saveOrUpdateCopy(String entityName, Object object) throws HibernateException
Sessionobject - a transient instance with state to be copiedHibernateExceptionpublic Object saveOrUpdateCopy(Object object) throws HibernateException
Sessionobject - a transient instance with state to be copiedHibernateExceptionpublic Object saveOrUpdateCopy(String entityName, Object object, Serializable id) throws HibernateException
Sessionobject - a persistent or transient instance with state to be copiedid - the identifier of the instance to copy toHibernateExceptionpublic Object saveOrUpdateCopy(Object object, Serializable id) throws HibernateException
Sessionobject - a persistent or transient instance with state to be copiedid - the identifier of the instance to copy toHibernateExceptionpublic void saveOrUpdateCopy(String entityName, Object object, Map copiedAlready) throws HibernateException
EventSourcesaveOrUpdateCopy in interface EventSourceHibernateExceptionpublic void delete(Object object) throws HibernateException
delete in interface Sessionobject - the instance to be removedHibernateExceptionpublic void delete(String entityName, Object object) throws HibernateException
delete in interface SessionentityName - The entity name for the instance to be removed.object - the instance to be removedHibernateExceptionpublic void delete(String entityName, Object object, boolean isCascadeDeleteEnabled, Set transientEntities) throws HibernateException
delete in interface EventSourceHibernateExceptionpublic void load(Object object, Serializable id) throws HibernateException
Sessionload in interface Sessionobject - an "empty" instance of the persistent classid - a valid identifier of an existing persistent instance of the classHibernateExceptionpublic Object load(Class entityClass, Serializable id) throws HibernateException
Sessionload in interface SessionentityClass - a persistent classid - a valid identifier of an existing persistent instance of the classHibernateExceptionpublic Object load(String entityName, Serializable id) throws HibernateException
Sessionload in interface SessionentityName - a persistent classid - a valid identifier of an existing persistent instance of the classHibernateExceptionpublic Object get(Class entityClass, Serializable id) throws HibernateException
Sessionget in interface SessionentityClass - a persistent classid - an identifierHibernateExceptionpublic Object get(String entityName, Serializable id) throws HibernateException
Sessionget in interface SessionentityName - the entity nameid - an identifierHibernateExceptionpublic Object immediateLoad(String entityName, Serializable id) throws HibernateException
immediateLoad in interface SessionImplementorHibernateExceptionpublic Object internalLoad(String entityName, Serializable id, boolean eager, boolean nullable) throws HibernateException
SessionImplementorinternalLoad in interface SessionImplementorHibernateExceptionpublic Object load(Class entityClass, Serializable id, LockMode lockMode) throws HibernateException
Sessionload in interface SessionentityClass - a persistent classid - a valid identifier of an existing persistent instance of the classlockMode - the lock levelHibernateExceptionpublic Object load(Class entityClass, Serializable id, LockOptions lockOptions) throws HibernateException
Sessionload in interface SessionentityClass - a persistent classid - a valid identifier of an existing persistent instance of the classlockOptions - contains the lock levelHibernateExceptionpublic Object load(String entityName, Serializable id, LockMode lockMode) throws HibernateException
Sessionload in interface SessionentityName - a persistent classid - a valid identifier of an existing persistent instance of the classlockMode - the lock levelHibernateExceptionpublic Object load(String entityName, Serializable id, LockOptions lockOptions) throws HibernateException
Sessionload in interface SessionentityName - a persistent classid - a valid identifier of an existing persistent instance of the classlockOptions - contains the lock levelHibernateExceptionpublic Object get(Class entityClass, Serializable id, LockMode lockMode) throws HibernateException
Sessionget in interface SessionentityClass - a persistent classid - an identifierlockMode - the lock modeHibernateExceptionpublic Object get(Class entityClass, Serializable id, LockOptions lockOptions) throws HibernateException
Sessionget in interface SessionentityClass - a persistent classid - an identifierlockOptions - the lock modeHibernateExceptionpublic Object get(String entityName, Serializable id, LockMode lockMode) throws HibernateException
Sessionget in interface SessionentityName - the entity nameid - an identifierlockMode - the lock modeHibernateExceptionpublic Object get(String entityName, Serializable id, LockOptions lockOptions) throws HibernateException
Sessionget in interface SessionentityName - the entity nameid - an identifierlockOptions - contains the lock modeHibernateExceptionpublic void refresh(Object object) throws HibernateException
Sessionrefresh in interface Sessionobject - a persistent or detached instanceHibernateExceptionpublic void refresh(Object object, LockMode lockMode) throws HibernateException
Sessionrefresh in interface Sessionobject - a persistent or detached instancelockMode - the lock mode to useHibernateExceptionpublic void refresh(Object object, LockOptions lockOptions) throws HibernateException
Sessionrefresh in interface Sessionobject - a persistent or detached instancelockOptions - contains the lock mode to useHibernateExceptionpublic void refresh(Object object, Map refreshedAlready) throws HibernateException
EventSourcerefresh in interface EventSourceHibernateExceptionpublic void replicate(Object obj, ReplicationMode replicationMode) throws HibernateException
Sessionreplicate in interface Sessionobj - a detached instance of a persistent classHibernateExceptionpublic void replicate(String entityName, Object obj, ReplicationMode replicationMode) throws HibernateException
Sessionreplicate in interface Sessionobj - a detached instance of a persistent classHibernateExceptionpublic void evict(Object object) throws HibernateException
evict in interface Sessionobject - a persistent instanceHibernateExceptionprotected boolean autoFlushIfRequired(Set querySpaces) throws HibernateException
HibernateExceptionpublic boolean isDirty()
throws HibernateException
SessionisDirty in interface SessionHibernateException - could not perform dirtying checkingpublic void flush()
throws HibernateException
Sessionflush-mode,
Transaction.commit() calls this method).
Flushing is the process of synchronizing the underlying persistent
store with persistable state held in memory.flush in interface SessionImplementorflush in interface SessionHibernateException - Indicates problems flushing the session or
talking to the database.public void forceFlush(EntityEntry entityEntry) throws HibernateException
EventSourceforceFlush in interface EventSourceHibernateExceptionpublic List find(String query) throws HibernateException
query - a query expressed in Hibernate's query languageHibernateExceptionpublic List find(String query, Object value, Type type) throws HibernateException
Sessionquery - the query stringvalue - a value to be bound to a "?" placeholder (JDBC IN parameter).type - the Hibernate type of the valueHibernateExceptionfor access to Type instancespublic List find(String query, Object[] values, Type[] types) throws HibernateException
Sessionquery - the query stringvalues - an array of values to be bound to the "?" placeholders (JDBC IN parameters).types - an array of Hibernate types of the valuesHibernateExceptionfor access to Type instancespublic List list(String query, QueryParameters queryParameters) throws HibernateException
SessionImplementorlist in interface SessionImplementorHibernateExceptionpublic int executeUpdate(String query, QueryParameters queryParameters) throws HibernateException
SessionImplementorexecuteUpdate in interface SessionImplementorHibernateExceptionpublic int executeNativeUpdate(NativeSQLQuerySpecification nativeQuerySpecification, QueryParameters queryParameters) throws HibernateException
SessionImplementorexecuteNativeUpdate in interface SessionImplementorHibernateExceptionpublic Iterator iterate(String query) throws HibernateException
Sessionquery - the query stringHibernateExceptionpublic Iterator iterate(String query, Object value, Type type) throws HibernateException
Sessionquery - the query stringvalue - a value to be witten to a "?" placeholder in the query stringtype - the hibernate type of valueHibernateExceptionpublic Iterator iterate(String query, Object[] values, Type[] types) throws HibernateException
Sessionquery - the query stringvalues - a list of values to be written to "?" placeholders in the querytypes - a list of Hibernate types of the valuesHibernateExceptionpublic Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException
SessionImplementoriterate in interface SessionImplementorHibernateExceptionpublic ScrollableResults scroll(String query, QueryParameters queryParameters) throws HibernateException
SessionImplementorscroll in interface SessionImplementorHibernateExceptionpublic int delete(String query) throws HibernateException
SessionSession.delete(Object) individually.query - the query stringHibernateExceptionpublic int delete(String query, Object value, Type type) throws HibernateException
SessionSession.delete(Object) individually.query - the query stringvalue - a value to be witten to a "?" placeholder in the query string.type - the hibernate type of value.HibernateExceptionpublic int delete(String query, Object[] values, Type[] types) throws HibernateException
SessionSession.delete(Object) individually.query - the query stringvalues - a list of values to be written to "?" placeholders in the query.types - a list of Hibernate types of the valuesHibernateExceptionpublic Query createFilter(Object collection, String queryString)
SessioncreateFilter in interface Sessioncollection - a persistent collectionqueryString - a Hibernate querypublic Query getNamedQuery(String queryName) throws MappingException
SessionImplementorgetNamedQuery in interface SessionImplementorgetNamedQuery in interface SessiongetNamedQuery in class AbstractSessionImplqueryName - the name of a query defined externallyMappingExceptionpublic Object instantiate(String entityName, Serializable id) throws HibernateException
SessionImplementorinstantiate in interface SessionImplementorHibernateExceptionpublic Object instantiate(EntityPersister persister, Serializable id) throws HibernateException
instantiate in interface EventSourceHibernateExceptionpublic EntityMode getEntityMode()
SessiongetEntityMode in interface SessionImplementorgetEntityMode in interface Sessionpublic void setFlushMode(FlushMode flushMode)
SessionFlushMode.MANUAL at the start of the session (in
order to achieve some extra performance).setFlushMode in interface SessionImplementorsetFlushMode in interface SessionflushMode - the new flush modeFlushModepublic FlushMode getFlushMode()
SessiongetFlushMode in interface SessionImplementorgetFlushMode in interface Sessionpublic CacheMode getCacheMode()
SessiongetCacheMode in interface SessionImplementorgetCacheMode in interface Sessionpublic void setCacheMode(CacheMode cacheMode)
SessionsetCacheMode in interface SessionImplementorsetCacheMode in interface SessioncacheMode - The new cache mode.public Transaction getTransaction() throws HibernateException
SessiongetTransaction in interface SessionHibernateExceptionTransactionpublic Transaction beginTransaction() throws HibernateException
SessionbeginTransaction in interface SessionHibernateExceptionTransactionpublic void afterTransactionBegin(Transaction tx)
JDBCContext.ContextafterTransactionBegin in interface JDBCContext.Contextpublic EntityPersister getEntityPersister(String entityName, Object object)
SessionImplementorgetEntityPersister in interface SessionImplementorentityName - optional entity nameobject - the entity instancepublic Serializable getIdentifier(Object object) throws HibernateException
SessiongetIdentifier in interface Sessionobject - a persistent instanceTransientObjectException - if the instance is transient or associated with
a different sessionHibernateExceptionpublic Serializable getContextEntityIdentifier(Object object)
getContextEntityIdentifier in interface SessionImplementorpublic Collection filter(Object collection, String filter) throws HibernateException
Sessioncollection - a persistent collection to filterfilter - a filter query stringHibernateExceptionpublic Collection filter(Object collection, String filter, Object value, Type type) throws HibernateException
Sessioncollection - a persistent collection to filterfilter - a filter query stringvalue - a value to be witten to a "?" placeholder in the query stringtype - the hibernate type of valueHibernateExceptionpublic Collection filter(Object collection, String filter, Object[] values, Type[] types) throws HibernateException
Sessioncollection - a persistent collection to filterfilter - a filter query stringvalues - a list of values to be written to "?" placeholders in the querytypes - a list of Hibernate types of the valuesHibernateExceptionpublic List listFilter(Object collection, String filter, QueryParameters queryParameters) throws HibernateException
SessionImplementorlistFilter in interface SessionImplementorHibernateExceptionpublic Iterator iterateFilter(Object collection, String filter, QueryParameters queryParameters) throws HibernateException
SessionImplementoriterateFilter in interface SessionImplementorHibernateExceptionpublic Criteria createCriteria(Class persistentClass, String alias)
SessioncreateCriteria in interface SessionpersistentClass - a class, which is persistent, or has persistent subclassespublic Criteria createCriteria(String entityName, String alias)
SessioncreateCriteria in interface Sessionpublic Criteria createCriteria(Class persistentClass)
SessioncreateCriteria in interface SessionpersistentClass - a class, which is persistent, or has persistent subclassespublic Criteria createCriteria(String entityName)
SessioncreateCriteria in interface Sessionpublic ScrollableResults scroll(CriteriaImpl criteria, ScrollMode scrollMode)
SessionImplementorscroll in interface SessionImplementorpublic List list(CriteriaImpl criteria) throws HibernateException
SessionImplementorlist in interface SessionImplementorHibernateExceptionpublic boolean contains(Object object)
Sessionpublic Query createQuery(String queryString)
SessioncreateQuery in interface SessioncreateQuery in class AbstractSessionImplqueryString - a HQL querypublic SQLQuery createSQLQuery(String sql)
SessioncreateSQLQuery in interface SessioncreateSQLQuery in class AbstractSessionImplsql - a SQL querypublic Query createSQLQuery(String sql, String returnAlias, Class returnClass)
SessionSQLQuery.sql - a query expressed in SQLreturnAlias - a table alias that appears inside {} in the SQL stringreturnClass - the returned persistent classpublic Query createSQLQuery(String sql, String[] returnAliases, Class[] returnClasses)
SessionSQLQuery.sql - a query expressed in SQLreturnAliases - an array of table aliases that appear inside {} in the SQL stringreturnClasses - the returned persistent classespublic ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException
SessionImplementorscrollCustomQuery in interface SessionImplementorHibernateExceptionpublic List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters) throws HibernateException
SessionImplementorlistCustomQuery in interface SessionImplementorHibernateExceptionpublic SessionFactory getSessionFactory()
SessiongetSessionFactory in interface SessionSessionFactorypublic void initializeCollection(PersistentCollection collection, boolean writing) throws HibernateException
SessionImplementorinitializeCollection in interface SessionImplementorHibernateExceptionpublic String bestGuessEntityName(Object object)
SessionImplementorbestGuessEntityName in interface SessionImplementorpublic String getEntityName(Object object)
SessiongetEntityName in interface Sessionobject - a persistent entitypublic String guessEntityName(Object object) throws HibernateException
SessionImplementorguessEntityName in interface SessionImplementorHibernateExceptionpublic void cancelQuery()
throws HibernateException
SessioncancelQuery in interface SessionHibernateException - There was a problem canceling the querypublic Interceptor getInterceptor()
SessionImplementorgetInterceptor in interface SessionImplementorpublic int getDontFlushFromFind()
getDontFlushFromFind in interface SessionImplementorpublic EventListeners getListeners()
SessionImplementorgetListeners in interface SessionImplementorpublic ActionQueue getActionQueue()
EventSourcegetActionQueue in interface EventSourcepublic PersistenceContext getPersistenceContext()
SessionImplementorgetPersistenceContext in interface SessionImplementorpublic SessionStatistics getStatistics()
SessiongetStatistics in interface Sessionpublic boolean isEventSource()
isEventSource in interface SessionImplementorpublic boolean isDefaultReadOnly()
isDefaultReadOnly in interface SessionSession.isReadOnly(Object)public void setDefaultReadOnly(boolean defaultReadOnly)
setDefaultReadOnly in interface SessiondefaultReadOnly - true, the default for loaded entities/proxies is read-only;
false, the default for loaded entities/proxies is modifiableTo override this session's read-only/modifiable setting for entities
and proxies loaded by a Query:,
Query.setReadOnly(boolean)public boolean isReadOnly(Object entityOrProxy)
SessionisReadOnly in interface SessionentityOrProxy - an entity or HibernateProxySession.isDefaultReadOnly()public void setReadOnly(Object entity, boolean readOnly)
SessionsetReadOnly in interface Sessionentity - an entity or HibernateProxyreadOnly - if true, the entity or proxy is made read-only;
if false, the entity or proxy is made modifiable.To override this session's read-only/modifiable setting for entities
and proxies loaded by a Query:,
Query.setReadOnly(boolean)public void doWork(Work work) throws HibernateException
SessiondoWork in interface Sessionwork - The work to be performed.HibernateException - Generally indicates wrapped SQLExceptionpublic void afterScrollOperation()
afterScrollOperation in interface SessionImplementorpublic JDBCContext getJDBCContext()
getJDBCContext in interface SessionImplementorpublic LoadQueryInfluencers getLoadQueryInfluencers()
SessionImplementorgetLoadQueryInfluencers in interface SessionImplementorpublic Filter getEnabledFilter(String filterName)
getEnabledFilter in interface SessionfilterName - The name of the filter to be retrieved.public Filter enableFilter(String filterName)
enableFilter in interface SessionfilterName - The name of the filter to be enabled.public void disableFilter(String filterName)
disableFilter in interface SessionfilterName - The name of the filter to be disabled.public Object getFilterParameterValue(String filterParameterName)
getFilterParameterValue in interface SessionImplementorfilterParameterName - The filter parameter name in the format
{FILTER_NAME.PARAMETER_NAME}.public Type getFilterParameterType(String filterParameterName)
getFilterParameterType in interface SessionImplementorfilterParameterName - The filter parameter name in the format
{FILTER_NAME.PARAMETER_NAME}.public Map getEnabledFilters()
FilterImpl
instance.getEnabledFilters in interface SessionImplementorpublic String getFetchProfile()
getFetchProfile in interface SessionImplementorpublic void setFetchProfile(String fetchProfile)
setFetchProfile in interface SessionImplementorfetchProfile - The internal fetch profile name to usepublic boolean isFetchProfileEnabled(String name) throws UnknownProfileException
SessionisFetchProfileEnabled in interface Sessionname - The name of the profile to be checked.UnknownProfileException - Indicates that the given name does not
match any known profile namesfor discussion of this featurepublic void enableFetchProfile(String name) throws UnknownProfileException
SessionenableFetchProfile in interface Sessionname - The name of the fetch profile to be enabled.UnknownProfileException - Indicates that the given name does not
match any known profile namesfor discussion of this featurepublic void disableFetchProfile(String name) throws UnknownProfileException
SessiondisableFetchProfile in interface Sessionname - The name of the fetch profile to be disabled.UnknownProfileException - Indicates that the given name does not
match any known profile namesfor discussion of this featurepublic Object execute(LobCreationContext.Callback callback)
Connection.execute in interface LobCreationContextcallback - The callback to execute .public TypeHelper getTypeHelper()
TypeHelper associated with this session's SessionFactory.
Equivalent to calling Session.getSessionFactory().getTypeHelper()getTypeHelper in interface SessionTypeHelper associated with this session's SessionFactorypublic LobHelper getLobHelper()
getLobHelper in interface SessionCopyright © 2002-2017 Red Hat Middleware, LLC. All Rights Reserved