SessionImplementor (Hibernate JavaDocs)
Date: 2012-04-05

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hibernate.engine.spi
Interface SessionImplementor

All Superinterfaces:
  LobCreationContext, Serializable

All Known Subinterfaces:
  EventSource

All Known Implementing Classes:
  AbstractDelegateSessionImplementor, AbstractSessionImpl, SessionImpl, StatelessSessionImpl, ToOneDelegateSessionImplementor

    public interface SessionImplementor

extends Serializable, LobCreationContext

Defines the internal contract between `Session` / `StatelessSession` and other parts of Hibernate such as `Type`, `EntityPersister` and `CollectionPersister` implementors

Nested Class Summary

Nested classes/interfaces inherited from interface org.hibernate.engine.jdbc.LobCreationContext
`LobCreationContext.Callback<T>`

Method Summary
`void` | `afterScrollOperation()`
`void` | `applyNonFlushedChanges(NonFlushedChanges nonFlushedChanges)` Apply non-flushed changes from a different session to this session.
`String` | `bestGuessEntityName(Object object)` The best guess entity name for an entity not in an association
`Connection` | `connection()`
`void` | `disableTransactionAutoJoin()` Disable automatic transaction joining.
`int` | `executeNativeUpdate(NativeSQLQuerySpecification specification, 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()`
`CacheKey` | `generateCacheKey(Serializable id, Type type, String entityOrRoleName)` Hide the changing requirements of cache key creation.
`EntityKey` | `generateEntityKey(Serializable id, EntityPersister persister)` Hide the changing requirements of entity key creation
`CacheMode` | `getCacheMode()`
`Serializable` | `getContextEntityIdentifier(Object object)` Return the identifier of the persistent object, or null if not associated with the session
`int` | `getDontFlushFromFind()`
`Map` | `getEnabledFilters()` Deprecated. use #getLoadQueryInfluencers instead
`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`
`String` | `getFetchProfile()` Deprecated. use #getLoadQueryInfluencers instead
`Type` | `getFilterParameterType(String filterParameterName)` Deprecated. use #getLoadQueryInfluencers instead
`Object` | `getFilterParameterValue(String filterParameterName)` Deprecated. use #getLoadQueryInfluencers instead
`FlushMode` | `getFlushMode()`
`Interceptor` | `getInterceptor()` Retrieves the interceptor currently in use by this event source.
`JdbcConnectionAccess` | `getJdbcConnectionAccess()` Provides access to JDBC connections
`LoadQueryInfluencers` | `getLoadQueryInfluencers()` Get the load query influencers associated with this session.
`Query` | `getNamedQuery(String name)` Get a Query instance for a named query or named native SQL query
`Query` | `getNamedSQLQuery(String name)` Get a Query instance for a named native SQL query
`NonFlushedChanges` | `getNonFlushedChanges()` Return changes to this session that have not been flushed yet.
`PersistenceContext` | `getPersistenceContext()` Get the persistence context for this session
`String` | `getTenantIdentifier()` Match te method on `Session` and `StatelessSession`
`long` | `getTimestamp()` System time before the start of the transaction
`TransactionCoordinator` | `getTransactionCoordinator()` Retrieve access to the session's transaction coordinator.
`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(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` | `isClosed()` Determine whether the session is closed.
`boolean` | `isConnected()`
`boolean` | `isEventSource()`
`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(NativeSQLQuerySpecification spec, QueryParameters queryParameters)` Execute a native SQL query, and return the results as a fully built list.
`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
`ScrollableResults` | `scroll(CriteriaImpl criteria, ScrollMode scrollMode)` Execute a criteria query
`ScrollableResults` | `scroll(NativeSQLQuerySpecification spec, QueryParameters queryParameters)` Execute a native SQL query, and return the results as a scrollable result.
`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` | `setFetchProfile(String name)` Deprecated. use `getLoadQueryInfluencers()` instead
`void` | `setFlushMode(FlushMode fm)`

Methods inherited from interface org.hibernate.engine.jdbc.LobCreationContext
`execute`

Method Detail

### getTenantIdentifier

    String getTenantIdentifier()

  Match te method on `Session` and `StatelessSession`

  Returns:
    The tenant identifier of this session

### getJdbcConnectionAccess

    JdbcConnectionAccess getJdbcConnectionAccess()

  Provides access to JDBC connections

  Returns:
    The contract for accessing JDBC connections.

### generateEntityKey

    EntityKey generateEntityKey(Serializable id,
                                EntityPersister persister)

  Hide the changing requirements of entity key creation

  Parameters:
    `id` - The entity id
    `persister` - The entity persister
  Returns:
    The entity key

### generateCacheKey

    CacheKey generateCacheKey(Serializable id,
                              Type type,
                              String entityOrRoleName)

  Hide the changing requirements of cache key creation.

  Parameters:
    `id` - The entity identifier or collection key.
    `type` - The type
    `entityOrRoleName` - The entity name or collection role.
  Returns:
    The cache key

### getInterceptor

    Interceptor getInterceptor()

  Retrieves the interceptor currently in use by this event source.

  Returns:
    The interceptor.

### setAutoClear

    void setAutoClear(boolean enabled)

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

### disableTransactionAutoJoin

    void disableTransactionAutoJoin()

  Disable automatic transaction joining. The really only has any effect for CMT transactions. The default Hibernate behavior is to auto join any active JTA transaction (register `Synchronization`). JPA however defines an explicit join transaction operation. See javax.persistence.EntityManager#joinTransaction

### isTransactionInProgress

    boolean isTransactionInProgress()

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

### initializeCollection

    void initializeCollection(PersistentCollection collection,
                              boolean writing)
                              throws HibernateException

  Initialize the collection (if not already initialized)

  Throws:
    `HibernateException`

### internalLoad

    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

    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

    long getTimestamp()

  System time before the start of the transaction

### getFactory

    SessionFactoryImplementor getFactory()

  Get the creating `SessionFactoryImplementor`

### list

    List list(String query,
              QueryParameters queryParameters)
              throws HibernateException

  Execute a `find()` query

  Throws:
    `HibernateException`

### iterate

    Iterator iterate(String query,
                     QueryParameters queryParameters)
                     throws HibernateException

  Execute an `iterate()` query

  Throws:
    `HibernateException`

### scroll

    ScrollableResults scroll(String query,
                             QueryParameters queryParameters)
                             throws HibernateException

  Execute a `scroll()` query

  Throws:
    `HibernateException`

### scroll

    ScrollableResults scroll(CriteriaImpl criteria,
                             ScrollMode scrollMode)

  Execute a criteria query

### list

    List list(CriteriaImpl criteria)

  Execute a criteria query

### listFilter

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

  Execute a filter

  Throws:
    `HibernateException`

### iterateFilter

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

  Iterate a filter

  Throws:
    `HibernateException`

### getEntityPersister

    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

    Object getEntityUsingInterceptor(EntityKey key)
                                     throws HibernateException

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

  Throws:
    `HibernateException`

### getContextEntityIdentifier

    Serializable getContextEntityIdentifier(Object object)

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

### bestGuessEntityName

    String bestGuessEntityName(Object object)

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

### guessEntityName

    String guessEntityName(Object entity)
                           throws HibernateException

  The guessed entity name for an entity not in an association

  Throws:
    `HibernateException`

### instantiate

    Object instantiate(String entityName,
                       Serializable id)
                       throws HibernateException

  Instantiate the entity class, initializing with the given identifier

  Throws:
    `HibernateException`

### listCustomQuery

    List listCustomQuery(CustomQuery customQuery,
                         QueryParameters queryParameters)
                         throws HibernateException

  Execute an SQL Query

  Throws:
    `HibernateException`

### scrollCustomQuery

    ScrollableResults scrollCustomQuery(CustomQuery customQuery,
                                        QueryParameters queryParameters)
                                        throws HibernateException

  Execute an SQL Query

  Throws:
    `HibernateException`

### list

    List list(NativeSQLQuerySpecification spec,
              QueryParameters queryParameters)
              throws HibernateException

  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.
  Throws:
    `HibernateException`

### scroll

    ScrollableResults scroll(NativeSQLQuerySpecification spec,
                             QueryParameters queryParameters)
                             throws HibernateException

  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.
  Throws:
    `HibernateException`

### getFilterParameterValue

    @Deprecated
    Object getFilterParameterValue(String filterParameterName)

  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.

### getFilterParameterType

    @Deprecated
    Type getFilterParameterType(String filterParameterName)

  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

### getEnabledFilters

    @Deprecated
    Map getEnabledFilters()

  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.

### getDontFlushFromFind

    int getDontFlushFromFind()

### getPersistenceContext

    PersistenceContext getPersistenceContext()

  Get the persistence context for this session

### executeUpdate

    int executeUpdate(String query,
                      QueryParameters queryParameters)
                      throws HibernateException

  Execute a HQL update or delete query

  Throws:
    `HibernateException`

### executeNativeUpdate

    int executeNativeUpdate(NativeSQLQuerySpecification specification,
                            QueryParameters queryParameters)
                            throws HibernateException

  Execute a native SQL update or delete query

  Throws:
    `HibernateException`

### getNonFlushedChanges

    NonFlushedChanges getNonFlushedChanges()
                                           throws HibernateException

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

  Returns:
    The non-flushed changes.
  Throws:
    `HibernateException`

### applyNonFlushedChanges

    void applyNonFlushedChanges(NonFlushedChanges nonFlushedChanges)
                                throws HibernateException

  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
  Throws:
    `HibernateException`

### getCacheMode

    CacheMode getCacheMode()

### setCacheMode

    void setCacheMode(CacheMode cm)

### isOpen

    boolean isOpen()

### isConnected

    boolean isConnected()

### getFlushMode

    FlushMode getFlushMode()

### setFlushMode

    void setFlushMode(FlushMode fm)

### connection

    Connection connection()

### flush

    void flush()

### getNamedQuery

    Query getNamedQuery(String name)

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

### getNamedSQLQuery

    Query getNamedSQLQuery(String name)

  Get a Query instance for a named native SQL query

### isEventSource

    boolean isEventSource()

### afterScrollOperation

    void afterScrollOperation()

### getFetchProfile

    @Deprecated
    String getFetchProfile()

  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.

### setFetchProfile

    @Deprecated
    void setFetchProfile(String name)

  Deprecated. use `getLoadQueryInfluencers()` instead

  Set the current internal fetch profile for this session.

  Parameters:
    `name` - The internal fetch profile name to use

### getTransactionCoordinator

    TransactionCoordinator getTransactionCoordinator()

  Retrieve access to the session's transaction coordinator.

  Returns:
    The transaction coordinator.

### isClosed

    boolean isClosed()

  Determine whether the session is closed. Provided separately from `isOpen()` as this method does not attempt any JTA synchronization 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.

### getLoadQueryInfluencers

    LoadQueryInfluencers getLoadQueryInfluencers()

  Get the load query influencers associated with this session.

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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.