public interface

SessionImplementor

implements Serializable
org.hibernate.engine.SessionImplementor
Known Indirect Subclasses

Class Overview

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

Summary

Public Methods
abstract void afterScrollOperation()
abstract void afterTransactionCompletion(boolean successful, Transaction tx)
Notify the session that the transaction completed, so we no longer own the old locks.
abstract void applyNonFlushedChanges(NonFlushedChanges nonFlushedChanges)
Apply non-flushed changes from a different session to this session.
abstract void beforeTransactionCompletion(Transaction tx)
Notify the session that the transaction is about to complete
abstract String bestGuessEntityName(Object object)
The best guess entity name for an entity not in an association
abstract Connection connection()
abstract int executeNativeUpdate(NativeSQLQuerySpecification specification, QueryParameters queryParameters)
Execute a native SQL update or delete query
abstract int executeUpdate(String query, QueryParameters queryParameters)
Execute a HQL update or delete query
abstract void flush()
abstract Batcher getBatcher()
Get the prepared statement Batcher for this session
abstract CacheMode getCacheMode()
abstract Serializable getContextEntityIdentifier(Object object)
Return the identifier of the persistent object, or null if not associated with the session
abstract int getDontFlushFromFind()
abstract Map getEnabledFilters()
This method is deprecated. use #getLoadQueryInfluencers instead
abstract EntityMode getEntityMode()
abstract EntityPersister getEntityPersister(String entityName, Object object)
Get the EntityPersister for any instance
abstract Object getEntityUsingInterceptor(EntityKey key)
Get the entity instance associated with the given Key, calling the Interceptor if necessary
abstract SessionFactoryImplementor getFactory()
Get the creating SessionFactoryImplementor
abstract String getFetchProfile()
This method is deprecated. use #getLoadQueryInfluencers instead
abstract Type getFilterParameterType(String filterParameterName)
This method is deprecated. use #getLoadQueryInfluencers instead
abstract Object getFilterParameterValue(String filterParameterName)
This method is deprecated. use #getLoadQueryInfluencers instead
abstract FlushMode getFlushMode()
abstract Interceptor getInterceptor()
Retrieves the interceptor currently in use by this event source.
abstract JDBCContext getJDBCContext()
abstract EventListeners getListeners()
Retrieves the configured event listeners from this event source.
abstract LoadQueryInfluencers getLoadQueryInfluencers()
Get the load query influencers associated with this session.
abstract Query getNamedQuery(String name)
Get a Query instance for a named query or named native SQL query
abstract Query getNamedSQLQuery(String name)
Get a Query instance for a named native SQL query
abstract NonFlushedChanges getNonFlushedChanges()
Return changes to this session that have not been flushed yet.
abstract PersistenceContext getPersistenceContext()
Get the persistence context for this session
abstract long getTimestamp()
System time before the start of the transaction
abstract String guessEntityName(Object entity)
The guessed entity name for an entity not in an association
abstract Object immediateLoad(String entityName, Serializable id)
Load an instance immediately.
abstract void initializeCollection(PersistentCollection collection, boolean writing)
Initialize the collection (if not already initialized)
abstract Object instantiate(String entityName, Serializable id)
Instantiate the entity class, initializing with the given identifier
abstract Object internalLoad(String entityName, Serializable id, boolean eager, boolean nullable)
Load an instance without checking if it was deleted.
abstract boolean isClosed()
Determine whether the session is closed.
abstract boolean isConnected()
abstract boolean isEventSource()
abstract boolean isOpen()
abstract boolean isTransactionInProgress()
Does this Session have an active Hibernate transaction or is there a JTA transaction in progress?
abstract Iterator iterate(String query, QueryParameters queryParameters)
Execute an iterate() query
abstract Iterator iterateFilter(Object collection, String filter, QueryParameters queryParameters)
Iterate a filter
abstract List list(NativeSQLQuerySpecification spec, QueryParameters queryParameters)
Execute a native SQL query, and return the results as a fully built list.
abstract List list(String query, QueryParameters queryParameters)
Execute a find() query
abstract List list(CriteriaImpl criteria)
Execute a criteria query
abstract List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
Execute an SQL Query
abstract List listFilter(Object collection, String filter, QueryParameters queryParameters)
Execute a filter
abstract ScrollableResults scroll(CriteriaImpl criteria, ScrollMode scrollMode)
Execute a criteria query
abstract ScrollableResults scroll(String query, QueryParameters queryParameters)
Execute a scroll() query
abstract ScrollableResults scroll(NativeSQLQuerySpecification spec, QueryParameters queryParameters)
Execute a native SQL query, and return the results as a scrollable result.
abstract ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
Execute an SQL Query
abstract void setAutoClear(boolean enabled)
Enable/disable automatic cache clearing from after transaction completion (for EJB3)
abstract void setCacheMode(CacheMode cm)
abstract void setFetchProfile(String name)
This method is deprecated. use #getLoadQueryInfluencers instead
abstract void setFlushMode(FlushMode fm)

Public Methods

public abstract void afterScrollOperation ()

public abstract 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.

public abstract void applyNonFlushedChanges (NonFlushedChanges nonFlushedChanges)

Apply non-flushed changes from a different session to this session. It is assumed that this SessionImpl is "clean" (e.g., has no non-flushed changes, no cached entities, no cached collections, no queued actions). The specified NonFlushedChanges object cannot be bound to any session.

Parameters
nonFlushedChanges the non-flushed changes

public abstract void beforeTransactionCompletion (Transaction tx)

Notify the session that the transaction is about to complete

public abstract String bestGuessEntityName (Object object)

The best guess entity name for an entity not in an association

public abstract Connection connection ()

public abstract int executeNativeUpdate (NativeSQLQuerySpecification specification, QueryParameters queryParameters)

Execute a native SQL update or delete query

public abstract int executeUpdate (String query, QueryParameters queryParameters)

Execute a HQL update or delete query

public abstract void flush ()

public abstract Batcher getBatcher ()

Get the prepared statement Batcher for this session

public abstract CacheMode getCacheMode ()

public abstract Serializable getContextEntityIdentifier (Object object)

Return the identifier of the persistent object, or null if not associated with the session

public abstract int getDontFlushFromFind ()

public abstract Map getEnabledFilters ()

This method is deprecated.
use #getLoadQueryInfluencers instead

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.

public abstract EntityMode getEntityMode ()

public abstract EntityPersister getEntityPersister (String entityName, Object object)

Get the EntityPersister for any instance

Parameters
entityName optional entity name
object the entity instance

public abstract Object getEntityUsingInterceptor (EntityKey key)

Get the entity instance associated with the given Key, calling the Interceptor if necessary

public abstract SessionFactoryImplementor getFactory ()

Get the creating SessionFactoryImplementor

public abstract String getFetchProfile ()

This method is deprecated.
use #getLoadQueryInfluencers instead

Get the internal fetch profile currently associated with this session.

Returns
  • The current internal fetch profile, or null if none currently associated.

public abstract Type getFilterParameterType (String filterParameterName)

This method is deprecated.
use #getLoadQueryInfluencers instead

Retreive the type for a given filter parrameter.

Parameters
filterParameterName The filter parameter name in the format {FILTER_NAME.PARAMETER_NAME}.
Returns
  • The filter param type

public abstract Object getFilterParameterValue (String filterParameterName)

This method is deprecated.
use #getLoadQueryInfluencers instead

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.

public abstract FlushMode getFlushMode ()

public abstract Interceptor getInterceptor ()

Retrieves the interceptor currently in use by this event source.

Returns
  • The interceptor.

public abstract JDBCContext getJDBCContext ()

public abstract EventListeners getListeners ()

Retrieves the configured event listeners from this event source.

Returns
  • The configured event listeners.

public abstract LoadQueryInfluencers getLoadQueryInfluencers ()

Get the load query influencers associated with this session.

Returns
  • the load query influencers associated with this session; should never be null.

public abstract Query getNamedQuery (String name)

Get a Query instance for a named query or named native SQL query

public abstract Query getNamedSQLQuery (String name)

Get a Query instance for a named native SQL query

public abstract NonFlushedChanges getNonFlushedChanges ()

Return changes to this session that have not been flushed yet.

Returns
  • The non-flushed changes.

public abstract PersistenceContext getPersistenceContext ()

Get the persistence context for this session

public abstract long getTimestamp ()

System time before the start of the transaction

public abstract String guessEntityName (Object entity)

The guessed entity name for an entity not in an association

public abstract Object immediateLoad (String entityName, Serializable id)

Load an instance immediately. This method is only called when lazily initializing a proxy. Do not return the proxy.

public abstract void initializeCollection (PersistentCollection collection, boolean writing)

Initialize the collection (if not already initialized)

public abstract Object instantiate (String entityName, Serializable id)

Instantiate the entity class, initializing with the given identifier

public abstract Object internalLoad (String entityName, Serializable id, boolean eager, boolean nullable)

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

public abstract boolean isClosed ()

Determine whether the session is closed. Provided seperately from isOpen() as this method does not attempt any JTA synch registration, where as isOpen() does; which makes this one nicer to use for most internal purposes.

Returns
  • True if the session is closed; false otherwise.

public abstract boolean isConnected ()

public abstract boolean isEventSource ()

public abstract boolean isOpen ()

public abstract boolean isTransactionInProgress ()

Does this Session have an active Hibernate transaction or is there a JTA transaction in progress?

public abstract Iterator iterate (String query, QueryParameters queryParameters)

Execute an iterate() query

public abstract Iterator iterateFilter (Object collection, String filter, QueryParameters queryParameters)

Iterate a filter

public abstract List list (NativeSQLQuerySpecification spec, QueryParameters queryParameters)

Execute a native SQL query, and return the results as a fully built list.

Parameters
spec The specification of the native SQL query to execute.
queryParameters The parameters by which to perform the execution.
Returns
  • The result list.

public abstract List list (String query, QueryParameters queryParameters)

Execute a find() query

public abstract List list (CriteriaImpl criteria)

Execute a criteria query

public abstract List listCustomQuery (CustomQuery customQuery, QueryParameters queryParameters)

Execute an SQL Query

public abstract List listFilter (Object collection, String filter, QueryParameters queryParameters)

Execute a filter

public abstract ScrollableResults scroll (CriteriaImpl criteria, ScrollMode scrollMode)

Execute a criteria query

public abstract ScrollableResults scroll (String query, QueryParameters queryParameters)

Execute a scroll() query

public abstract ScrollableResults scroll (NativeSQLQuerySpecification spec, QueryParameters queryParameters)

Execute a native SQL query, and return the results as a scrollable result.

Parameters
spec The specification of the native SQL query to execute.
queryParameters The parameters by which to perform the execution.
Returns
  • The resulting scrollable result.

public abstract ScrollableResults scrollCustomQuery (CustomQuery customQuery, QueryParameters queryParameters)

Execute an SQL Query

public abstract void setAutoClear (boolean enabled)

Enable/disable automatic cache clearing from after transaction completion (for EJB3)

public abstract void setCacheMode (CacheMode cm)

public abstract void setFetchProfile (String name)

This method is deprecated.
use #getLoadQueryInfluencers instead

Set the current internal fetch profile for this session.

Parameters
name The internal fetch profile name to use

public abstract void setFlushMode (FlushMode fm)