org.hibernate.engine
Interface SessionImplementor

All Superinterfaces:
Serializable, Session, Session
All Known Implementing Classes:
SessionImpl

public interface SessionImplementor
extends Session

Defines the internal contract between the Session and other parts of Hibernate such as implementors of Type or EntityPersister.

Author:
Gavin King
See Also:
the interface to the application, the actual implementation

Method Summary
 void afterTransactionCompletion(boolean successful, Transaction tx)
          Notify the session that the transaction completed, so we no longer own the old locks.
 void beforeTransactionCompletion(Transaction tx)
          Notify the session that the transaction is about to complete
 String bestGuessEntityName(Object object)
          The best guess entity name for an entity not in an association
 void delete(String entityName, Object child, boolean isCascadeDeleteEnabled)
          Cascade delete an entity instance
 int executeUpdate(String query, QueryParameters queryParameters)
          Execute a HQL update or delete query
 void forceFlush(EntityEntry e)
          Force an immediate flush
 ActionQueue getActionQueue()
          Get the ActionQueue for this session
 Batcher getBatcher()
          Get the prepared statement Batcher for this session
 int getDontFlushFromFind()
           
 Map getEnabledFilters()
          Return the currently enabled filters.
 Serializable getEntityIdentifier(Object obj)
          Return the identifier of the persistent object, or null if transient
 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
 SessionFactoryImplementor getFactory()
          Get the creating SessionFactoryImplementor
 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.
 Interceptor getInterceptor()
          Retrieves the interceptor currently in use by this event source.
 SessionEventListenerConfig getListeners()
          Retrieves the configured event listeners from this event source.
 PersistenceContext getPersistenceContext()
          Get the persistence context for this session
 long getTimestamp()
          System time before the start of the 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)
 Object instantiate(EntityPersister persister, Serializable id)
          Instantiate an entity instance, using either an interceptor, or the given persister
 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 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(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 merge(String entityName, Object object, Map copiedAlready)
          Cascade merge an entity instance
 void persist(String entityName, Object object, Map createdAlready)
          Cascade persist an entity instance
 void saveOrUpdateCopy(String entityName, Object object, Map copiedAlready)
          Cascade copy an entity instance
 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)
 
Methods inherited from interface org.hibernate.classic.Session
createSQLQuery, createSQLQuery, delete, delete, delete, filter, filter, filter, find, find, find, iterate, iterate, iterate, saveOrUpdateCopy, saveOrUpdateCopy, saveOrUpdateCopy, saveOrUpdateCopy
 
Methods inherited from interface org.hibernate.Session
beginTransaction, cancelQuery, clear, close, connection, contains, createCriteria, createCriteria, createCriteria, createCriteria, createFilter, createQuery, createSQLQuery, delete, disableFilter, disconnect, enableFilter, evict, flush, get, get, get, get, getCacheMode, getCurrentLockMode, getEnabledFilter, getEntityMode, getEntityName, getFlushMode, getIdentifier, getNamedQuery, getSession, getSessionFactory, getStatistics, isConnected, isDirty, isOpen, load, load, load, load, load, lock, lock, merge, merge, persist, persist, reconnect, reconnect, refresh, refresh, replicate, replicate, save, save, save, save, saveOrUpdate, saveOrUpdate, setCacheMode, setFlushMode, update, update, update, update
 

Method Detail

getInterceptor

public Interceptor getInterceptor()
Retrieves the interceptor currently in use by this event source.

Returns:
The interceptor.

setAutoClear

public void setAutoClear(boolean enabled)
Enable/disable automatic cache clearing from after transaction completion (for EJB3)


isTransactionInProgress

public boolean isTransactionInProgress()
Does this Session have an active Hibernate transaction or is there a JTA transaction in progress?


initializeCollection

public void initializeCollection(PersistentCollection collection,
                                 boolean writing)
                          throws HibernateException
Initialize the collection (if not already initialized)

Throws:
HibernateException

internalLoad

public Object internalLoad(String entityName,
                           Serializable id,
                           boolean eager,
                           boolean nullable)
                    throws HibernateException
Load an instance without checking if it was deleted. When nullable is disabled this method may create a new proxy or return an existing proxy; if it does not exist, throw an exception. When nullable is enabled, the method does not create new proxies (but might return an existing proxy); if it does not exist, return null. When eager is enabled, the object is eagerly fetched

Throws:
HibernateException

immediateLoad

public Object immediateLoad(String entityName,
                            Serializable id)
                     throws HibernateException
Load an instance immediately. This method is only called when lazily initializing a proxy. Do not return the proxy.

Throws:
HibernateException

getTimestamp

public long getTimestamp()
System time before the start of the transaction


getFactory

public SessionFactoryImplementor getFactory()
Get the creating SessionFactoryImplementor


getBatcher

public Batcher getBatcher()
Get the prepared statement Batcher for this session


list

public List list(String query,
                 QueryParameters queryParameters)
          throws HibernateException
Execute a find() query

Throws:
HibernateException

iterate

public Iterator iterate(String query,
                        QueryParameters queryParameters)
                 throws HibernateException
Execute an iterate() query

Throws:
HibernateException

scroll

public ScrollableResults scroll(String query,
                                QueryParameters queryParameters)
                         throws HibernateException
Execute a scroll() query

Throws:
HibernateException

listFilter

public List listFilter(Object collection,
                       String filter,
                       QueryParameters queryParameters)
                throws HibernateException
Execute a filter

Throws:
HibernateException

iterateFilter

public Iterator iterateFilter(Object collection,
                              String filter,
                              QueryParameters queryParameters)
                       throws HibernateException
Iterate a filter

Throws:
HibernateException

getEntityPersister

public EntityPersister getEntityPersister(String entityName,
                                          Object object)
                                   throws HibernateException
Get the EntityPersister for any instance

Parameters:
entityName - optional entity name
object - the entity instance
Throws:
HibernateException

getEntityUsingInterceptor

public Object getEntityUsingInterceptor(EntityKey key)
                                 throws HibernateException
Get the entity instance associated with the given Key, calling the Interceptor if necessary

Throws:
HibernateException

afterTransactionCompletion

public void afterTransactionCompletion(boolean successful,
                                       Transaction tx)
Notify the session that the transaction completed, so we no longer own the old locks. (Also we should release cache softlocks.) May be called multiple times during the transaction completion process. Also called after an autocommit, in which case the second argument is null.


beforeTransactionCompletion

public void beforeTransactionCompletion(Transaction tx)
Notify the session that the transaction is about to complete


getEntityIdentifier

public Serializable getEntityIdentifier(Object obj)
Return the identifier of the persistent object, or null if transient


bestGuessEntityName

public String bestGuessEntityName(Object object)
The best guess entity name for an entity not in an association


guessEntityName

public String guessEntityName(Object entity)
                       throws HibernateException
The guessed entity name for an entity not in an association

Throws:
HibernateException

instantiate

public Object instantiate(String entityName,
                          Serializable id)
                   throws HibernateException
Instantiate the entity class, initializing with the given identifier

Throws:
HibernateException

listCustomQuery

public List listCustomQuery(CustomQuery customQuery,
                            QueryParameters queryParameters)
                     throws HibernateException
Execute an SQL Query

Throws:
HibernateException

scrollCustomQuery

public ScrollableResults scrollCustomQuery(CustomQuery customQuery,
                                           QueryParameters queryParameters)
                                    throws HibernateException
Execute an SQL Query

Throws:
HibernateException

merge

public void merge(String entityName,
                  Object object,
                  Map copiedAlready)
           throws HibernateException
Cascade merge an entity instance

Throws:
HibernateException

persist

public void persist(String entityName,
                    Object object,
                    Map createdAlready)
             throws HibernateException
Cascade persist an entity instance

Throws:
HibernateException

saveOrUpdateCopy

public void saveOrUpdateCopy(String entityName,
                             Object object,
                             Map copiedAlready)
                      throws HibernateException
Cascade copy an entity instance

Throws:
HibernateException

delete

public void delete(String entityName,
                   Object child,
                   boolean isCascadeDeleteEnabled)
Cascade delete an entity instance


getFilterParameterValue

public Object getFilterParameterValue(String filterParameterName)
Retreive the currently set value for a filter parameter.

Parameters:
filterParameterName - The filter parameter name in the format {FILTER_NAME.PARAMETER_NAME}.
Returns:
The filter parameter value.

getFilterParameterType

public Type getFilterParameterType(String filterParameterName)
Retreive the type for a given filter parrameter.

Parameters:
filterParameterName - The filter parameter name in the format {FILTER_NAME.PARAMETER_NAME}.
Returns:

getEnabledFilters

public Map getEnabledFilters()
Return the currently enabled filters. The filter map is keyed by filter name, with values corresponding to the FilterImpl instance.

Returns:
The currently enabled filters.

forceFlush

public void forceFlush(EntityEntry e)
                throws HibernateException
Force an immediate flush

Throws:
HibernateException

getDontFlushFromFind

public int getDontFlushFromFind()

getListeners

public SessionEventListenerConfig getListeners()
Retrieves the configured event listeners from this event source.

Returns:
The configured event listeners.

instantiate

public Object instantiate(EntityPersister persister,
                          Serializable id)
                   throws HibernateException
Instantiate an entity instance, using either an interceptor, or the given persister

Throws:
HibernateException

getActionQueue

public ActionQueue getActionQueue()
Get the ActionQueue for this session


getPersistenceContext

public PersistenceContext getPersistenceContext()
Get the persistence context for this session


executeUpdate

public int executeUpdate(String query,
                         QueryParameters queryParameters)
                  throws HibernateException
Execute a HQL update or delete query

Throws:
HibernateException