org.hibernate.envers.entities.mapper.relation.lazy
Class AbstractDelegateSessionImplementor

java.lang.Object
  extended by org.hibernate.envers.entities.mapper.relation.lazy.AbstractDelegateSessionImplementor
All Implemented Interfaces:
Serializable, LobCreationContext, SessionImplementor
Direct Known Subclasses:
ToOneDelegateSessionImplementor

public abstract class AbstractDelegateSessionImplementor
extends Object
implements SessionImplementor

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.hibernate.engine.jdbc.LobCreationContext
LobCreationContext.Callback<T>
 
Field Summary
protected  SessionImplementor delegate
           
 
Constructor Summary
AbstractDelegateSessionImplementor(SessionImplementor delegate)
           
 
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.
abstract  Object doImmediateLoad(String entityName)
           
<T> T
execute(LobCreationContext.Callback<T> callback)
          Execute the given callback, making sure it has access to a viable JDBC Connection.
 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()
          Return the currently enabled filters.
 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()
          Get the internal fetch profile currently associated with this session.
 Type getFilterParameterType(String filterParameterName)
          Retreive the type for a given filter parrameter.
 Object getFilterParameterValue(String filterParameterName)
          Retreive the currently set value for a filter parameter.
 FlushMode getFlushMode()
           
 Interceptor getInterceptor()
          Retrieves the interceptor currently in use by this event source.
 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)
          Set the current internal fetch profile for this session.
 void setFlushMode(FlushMode fm)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delegate

protected SessionImplementor delegate
Constructor Detail

AbstractDelegateSessionImplementor

public AbstractDelegateSessionImplementor(SessionImplementor delegate)
Method Detail

doImmediateLoad

public abstract Object doImmediateLoad(String entityName)

immediateLoad

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

Specified by:
immediateLoad in interface SessionImplementor
Throws:
HibernateException

getTenantIdentifier

public String getTenantIdentifier()
Description copied from interface: SessionImplementor
Match te method on Session and StatelessSession

Specified by:
getTenantIdentifier in interface SessionImplementor
Returns:
The tenant identifier of this session

getJdbcConnectionAccess

public JdbcConnectionAccess getJdbcConnectionAccess()
Description copied from interface: SessionImplementor
Provides access to JDBC connections

Specified by:
getJdbcConnectionAccess in interface SessionImplementor
Returns:
The contract for accessing JDBC connections.

generateEntityKey

public EntityKey generateEntityKey(Serializable id,
                                   EntityPersister persister)
Description copied from interface: SessionImplementor
Hide the changing requirements of entity key creation

Specified by:
generateEntityKey in interface SessionImplementor
Parameters:
id - The entity id
persister - The entity persister
Returns:
The entity key

generateCacheKey

public CacheKey generateCacheKey(Serializable id,
                                 Type type,
                                 String entityOrRoleName)
Description copied from interface: SessionImplementor
Hide the changing requirements of cache key creation.

Specified by:
generateCacheKey in interface SessionImplementor
Parameters:
id - The entity identifier or collection key.
type - The type
entityOrRoleName - The entity name or collection role.
Returns:
The cache key

execute

public <T> T execute(LobCreationContext.Callback<T> callback)
Description copied from interface: LobCreationContext
Execute the given callback, making sure it has access to a viable JDBC Connection.

Specified by:
execute in interface LobCreationContext
Parameters:
callback - The callback to execute .
Returns:
The LOB created by the callback.

getLoadQueryInfluencers

public LoadQueryInfluencers getLoadQueryInfluencers()
Description copied from interface: SessionImplementor
Get the load query influencers associated with this session.

Specified by:
getLoadQueryInfluencers in interface SessionImplementor
Returns:
the load query influencers associated with this session; should never be null.

getInterceptor

public Interceptor getInterceptor()
Description copied from interface: SessionImplementor
Retrieves the interceptor currently in use by this event source.

Specified by:
getInterceptor in interface SessionImplementor
Returns:
The interceptor.

setAutoClear

public void setAutoClear(boolean enabled)
Description copied from interface: SessionImplementor
Enable/disable automatic cache clearing from after transaction completion (for EJB3)

Specified by:
setAutoClear in interface SessionImplementor

disableTransactionAutoJoin

public void disableTransactionAutoJoin()
Description copied from interface: SessionImplementor
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

Specified by:
disableTransactionAutoJoin in interface SessionImplementor

isTransactionInProgress

public boolean isTransactionInProgress()
Description copied from interface: SessionImplementor
Does this Session have an active Hibernate transaction or is there a JTA transaction in progress?

Specified by:
isTransactionInProgress in interface SessionImplementor

initializeCollection

public void initializeCollection(PersistentCollection collection,
                                 boolean writing)
                          throws HibernateException
Description copied from interface: SessionImplementor
Initialize the collection (if not already initialized)

Specified by:
initializeCollection in interface SessionImplementor
Throws:
HibernateException

internalLoad

public Object internalLoad(String entityName,
                           Serializable id,
                           boolean eager,
                           boolean nullable)
                    throws HibernateException
Description copied from interface: SessionImplementor
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

Specified by:
internalLoad in interface SessionImplementor
Throws:
HibernateException

getTimestamp

public long getTimestamp()
Description copied from interface: SessionImplementor
System time before the start of the transaction

Specified by:
getTimestamp in interface SessionImplementor

getFactory

public SessionFactoryImplementor getFactory()
Description copied from interface: SessionImplementor
Get the creating SessionFactoryImplementor

Specified by:
getFactory in interface SessionImplementor

list

public List list(String query,
                 QueryParameters queryParameters)
          throws HibernateException
Description copied from interface: SessionImplementor
Execute a find() query

Specified by:
list in interface SessionImplementor
Throws:
HibernateException

iterate

public Iterator iterate(String query,
                        QueryParameters queryParameters)
                 throws HibernateException
Description copied from interface: SessionImplementor
Execute an iterate() query

Specified by:
iterate in interface SessionImplementor
Throws:
HibernateException

scroll

public ScrollableResults scroll(String query,
                                QueryParameters queryParameters)
                         throws HibernateException
Description copied from interface: SessionImplementor
Execute a scroll() query

Specified by:
scroll in interface SessionImplementor
Throws:
HibernateException

scroll

public ScrollableResults scroll(CriteriaImpl criteria,
                                ScrollMode scrollMode)
Description copied from interface: SessionImplementor
Execute a criteria query

Specified by:
scroll in interface SessionImplementor

list

public List list(CriteriaImpl criteria)
Description copied from interface: SessionImplementor
Execute a criteria query

Specified by:
list in interface SessionImplementor

listFilter

public List listFilter(Object collection,
                       String filter,
                       QueryParameters queryParameters)
                throws HibernateException
Description copied from interface: SessionImplementor
Execute a filter

Specified by:
listFilter in interface SessionImplementor
Throws:
HibernateException

iterateFilter

public Iterator iterateFilter(Object collection,
                              String filter,
                              QueryParameters queryParameters)
                       throws HibernateException
Description copied from interface: SessionImplementor
Iterate a filter

Specified by:
iterateFilter in interface SessionImplementor
Throws:
HibernateException

getEntityPersister

public EntityPersister getEntityPersister(String entityName,
                                          Object object)
                                   throws HibernateException
Description copied from interface: SessionImplementor
Get the EntityPersister for any instance

Specified by:
getEntityPersister in interface SessionImplementor
Parameters:
entityName - optional entity name
object - the entity instance
Throws:
HibernateException

getEntityUsingInterceptor

public Object getEntityUsingInterceptor(EntityKey key)
                                 throws HibernateException
Description copied from interface: SessionImplementor
Get the entity instance associated with the given Key, calling the Interceptor if necessary

Specified by:
getEntityUsingInterceptor in interface SessionImplementor
Throws:
HibernateException

getContextEntityIdentifier

public Serializable getContextEntityIdentifier(Object object)
Description copied from interface: SessionImplementor
Return the identifier of the persistent object, or null if not associated with the session

Specified by:
getContextEntityIdentifier in interface SessionImplementor

bestGuessEntityName

public String bestGuessEntityName(Object object)
Description copied from interface: SessionImplementor
The best guess entity name for an entity not in an association

Specified by:
bestGuessEntityName in interface SessionImplementor

guessEntityName

public String guessEntityName(Object entity)
                       throws HibernateException
Description copied from interface: SessionImplementor
The guessed entity name for an entity not in an association

Specified by:
guessEntityName in interface SessionImplementor
Throws:
HibernateException

instantiate

public Object instantiate(String entityName,
                          Serializable id)
                   throws HibernateException
Description copied from interface: SessionImplementor
Instantiate the entity class, initializing with the given identifier

Specified by:
instantiate in interface SessionImplementor
Throws:
HibernateException

listCustomQuery

public List listCustomQuery(CustomQuery customQuery,
                            QueryParameters queryParameters)
                     throws HibernateException
Description copied from interface: SessionImplementor
Execute an SQL Query

Specified by:
listCustomQuery in interface SessionImplementor
Throws:
HibernateException

scrollCustomQuery

public ScrollableResults scrollCustomQuery(CustomQuery customQuery,
                                           QueryParameters queryParameters)
                                    throws HibernateException
Description copied from interface: SessionImplementor
Execute an SQL Query

Specified by:
scrollCustomQuery in interface SessionImplementor
Throws:
HibernateException

list

public List list(NativeSQLQuerySpecification spec,
                 QueryParameters queryParameters)
          throws HibernateException
Description copied from interface: SessionImplementor
Execute a native SQL query, and return the results as a fully built list.

Specified by:
list in interface SessionImplementor
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

public ScrollableResults scroll(NativeSQLQuerySpecification spec,
                                QueryParameters queryParameters)
                         throws HibernateException
Description copied from interface: SessionImplementor
Execute a native SQL query, and return the results as a scrollable result.

Specified by:
scroll in interface SessionImplementor
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

public Object getFilterParameterValue(String filterParameterName)
Description copied from interface: SessionImplementor
Retreive the currently set value for a filter parameter.

Specified by:
getFilterParameterValue in interface SessionImplementor
Parameters:
filterParameterName - The filter parameter name in the format {FILTER_NAME.PARAMETER_NAME}.
Returns:
The filter parameter value.

getFilterParameterType

public Type getFilterParameterType(String filterParameterName)
Description copied from interface: SessionImplementor
Retreive the type for a given filter parrameter.

Specified by:
getFilterParameterType in interface SessionImplementor
Parameters:
filterParameterName - The filter parameter name in the format {FILTER_NAME.PARAMETER_NAME}.
Returns:
The filter param type

getEnabledFilters

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

Specified by:
getEnabledFilters in interface SessionImplementor
Returns:
The currently enabled filters.

getDontFlushFromFind

public int getDontFlushFromFind()
Specified by:
getDontFlushFromFind in interface SessionImplementor

getPersistenceContext

public PersistenceContext getPersistenceContext()
Description copied from interface: SessionImplementor
Get the persistence context for this session

Specified by:
getPersistenceContext in interface SessionImplementor

executeUpdate

public int executeUpdate(String query,
                         QueryParameters queryParameters)
                  throws HibernateException
Description copied from interface: SessionImplementor
Execute a HQL update or delete query

Specified by:
executeUpdate in interface SessionImplementor
Throws:
HibernateException

executeNativeUpdate

public int executeNativeUpdate(NativeSQLQuerySpecification specification,
                               QueryParameters queryParameters)
                        throws HibernateException
Description copied from interface: SessionImplementor
Execute a native SQL update or delete query

Specified by:
executeNativeUpdate in interface SessionImplementor
Throws:
HibernateException

getNonFlushedChanges

public NonFlushedChanges getNonFlushedChanges()
                                       throws HibernateException
Description copied from interface: SessionImplementor
Return changes to this session that have not been flushed yet.

Specified by:
getNonFlushedChanges in interface SessionImplementor
Returns:
The non-flushed changes.
Throws:
HibernateException

applyNonFlushedChanges

public void applyNonFlushedChanges(NonFlushedChanges nonFlushedChanges)
                            throws HibernateException
Description copied from interface: SessionImplementor
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.

Specified by:
applyNonFlushedChanges in interface SessionImplementor
Parameters:
nonFlushedChanges - the non-flushed changes
Throws:
HibernateException

getCacheMode

public CacheMode getCacheMode()
Specified by:
getCacheMode in interface SessionImplementor

setCacheMode

public void setCacheMode(CacheMode cm)
Specified by:
setCacheMode in interface SessionImplementor

isOpen

public boolean isOpen()
Specified by:
isOpen in interface SessionImplementor

isConnected

public boolean isConnected()
Specified by:
isConnected in interface SessionImplementor

getFlushMode

public FlushMode getFlushMode()
Specified by:
getFlushMode in interface SessionImplementor

setFlushMode

public void setFlushMode(FlushMode fm)
Specified by:
setFlushMode in interface SessionImplementor

connection

public Connection connection()
Specified by:
connection in interface SessionImplementor

flush

public void flush()
Specified by:
flush in interface SessionImplementor

getNamedQuery

public Query getNamedQuery(String name)
Description copied from interface: SessionImplementor
Get a Query instance for a named query or named native SQL query

Specified by:
getNamedQuery in interface SessionImplementor

getNamedSQLQuery

public Query getNamedSQLQuery(String name)
Description copied from interface: SessionImplementor
Get a Query instance for a named native SQL query

Specified by:
getNamedSQLQuery in interface SessionImplementor

isEventSource

public boolean isEventSource()
Specified by:
isEventSource in interface SessionImplementor

afterScrollOperation

public void afterScrollOperation()
Specified by:
afterScrollOperation in interface SessionImplementor

setFetchProfile

public void setFetchProfile(String name)
Description copied from interface: SessionImplementor
Set the current internal fetch profile for this session.

Specified by:
setFetchProfile in interface SessionImplementor
Parameters:
name - The internal fetch profile name to use

getFetchProfile

public String getFetchProfile()
Description copied from interface: SessionImplementor
Get the internal fetch profile currently associated with this session.

Specified by:
getFetchProfile in interface SessionImplementor
Returns:
The current internal fetch profile, or null if none currently associated.

getTransactionCoordinator

public TransactionCoordinator getTransactionCoordinator()
Description copied from interface: SessionImplementor
Retrieve access to the session's transaction coordinator.

Specified by:
getTransactionCoordinator in interface SessionImplementor
Returns:
The transaction coordinator.

isClosed

public boolean isClosed()
Description copied from interface: SessionImplementor
Determine whether the session is closed. Provided separately from SessionImplementor.isOpen() as this method does not attempt any JTA synchronization registration, where as SessionImplementor.isOpen() does; which makes this one nicer to use for most internal purposes.

Specified by:
isClosed in interface SessionImplementor
Returns:
True if the session is closed; false otherwise.


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