Top Description Fields Constructors Methods
org.eclipse.persistence.internal.history

public Class HistoricalSession

extends AbstractSession
Class Inheritance
Imports
java.io.*, org.eclipse.persistence.platform.server.ServerPlatform, org.eclipse.persistence.queries.*, org.eclipse.persistence.exceptions.*, org.eclipse.persistence.history.*, org.eclipse.persistence.internal.helper.*, org.eclipse.persistence.internal.sessions.*

INTERNAL: Purpose: Allows the reading of objects as of a past time.

Description: All queries executed through this special lightweight session will return results as of a past time. Objects read will be cached in a special isolated cache.

Responsibilities:
Author
Stephen McRitchie
Since
OracleAS TopLink 10g (10.1.3)
See Also
org.eclipse.persistence.sessions.Session#acquireHistoricalSession

Field Summary

Modifier and TypeField and Description
protected final AsOfClause
protected final AbstractSession
Inherited from org.eclipse.persistence.internal.sessions.AbstractSession:
accessorsactiveCommandThreadsattributeGroupsbrokercommandManagercommitManagerdefaultReferenceModedeferredEventsdescriptorseventManagerexceptionHandlerexternalTransactionControlleridentityMapAccessorinjectionManagerintegrityCheckerisConcurrentisExecutingEventsisFinalizersEnabledisInBrokerisInProfileisLoggingOffisSynchronizedjpaQueriesProcessedlastDescriptorAccessedlogSessionStringmetadatalistenermultitenantContextPropertiesnamenumberOfActiveUnitsOfWorkobjectsLockedForClonepartitioningPolicypessimisticLockTimeoutDefaultpessimisticLockTimeoutUnitDefaultplatformprofilerprojectpropertiesqueriesqueryBuilderqueryTimeoutDefaultqueryTimeoutUnitDefaultserializersessionLogshouldCheckWriteLockshouldOptimizeResultSetAccessshouldPropagateChangesstaticMetamodelClassestablePerTenantDescriptorstablePerTenantQueriestolerateInvalidJPQLtransactionMutexwasJTSTransactionInternallyStarted

Constructor Summary

AccessConstructor and Description
public
HistoricalSession(AbstractSession parent, AsOfClause clause)

INTERNAL: Create and return a new Historical Session.

Method Summary

Modifier and TypeMethod and Description
public Session
acquireHistoricalSession(AsOfClause
Represents a valid snap shot time.
clause
)

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.acquireHistoricalSession.

Implements org.eclipse.persistence.sessions.Session.acquireHistoricalSession.

INTERNAL: Acquires a special historical session for reading objects as of a past time.
public UnitOfWorkImpl
public void
beginTransaction()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.beginTransaction.

INTERNAL: No transactions should be used inside a HistoricalSession.
public void
commitTransaction()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.commitTransaction.

INTERNAL: No transactions should be used inside a HistoricalSession.
public AsOfClause
getAsOfClause()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.getAsOfClause.

Implements org.eclipse.persistence.sessions.Session.getAsOfClause.

ADVANCED: Answers a read-only data object, which knows whether it is a wall-clock time or a system change number.
public Object
getAsOfValue()

PUBLIC: Answers the value this Session is As Of.

public AbstractSession

Returns:

a session with a live accessor
getExecutionSession
(DatabaseQuery
may store session name or reference class for brokers case
query
)

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.getExecutionSession.

INTERNAL: Gets the session which this query will be executed on.
public AbstractSession
getParent()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.getParent.

INTERNAL: Returns the parent Session.
public ServerPlatform
getServerPlatform()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.getServerPlatform.

Implements org.eclipse.persistence.sessions.Session.getServerPlatform.

INTERNAL: Marked internal as this is not customer API but helper methods for accessing the server platform from within TopLink's other sessions types (ie not DatabaseSession)
public boolean
hasAsOfClause()

ADVANCED: Answers if all objects are to be read as of a past time.

public Object
internalExecuteQuery(DatabaseQuery query, AbstractRecord databaseRow)

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery.

INTERNAL: Return the results from executing the database query.
public boolean
isHistoricalSession()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.isHistoricalSession.

INTERNAL: Return if this session is a historical session.
public boolean
isInTransaction()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.isInTransaction.

INTERNAL: Historical session are never in a transaction.
public DatabaseQuery
prepareDatabaseQuery(DatabaseQuery query)

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.prepareDatabaseQuery.

INTERNAL: A call back to do session specific preparation of a query.
public void
rollbackTransaction()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.rollbackTransaction.

INTERNAL: No transactions should be used inside a HistoricalSession.
public String
toString()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.toString.

Print the connection status with the session.
Inherited from org.eclipse.persistence.internal.sessions.AbstractSession:
acquireNonSynchronizedUnitOfWorkacquireNonSynchronizedUnitOfWorkacquireRepeatableWriteUnitOfWorkacquireUnitOfWorkaddAliasaddJPAQueryaddJPATablePerTenantQueryaddMultitenantContextPropertyaddQueryaddQueryaddQueryaddStaticMetamodelClassaddTablePerTenantDescriptoraddTablePerTenantQuerybasicBeginTransactionbasicBeginTransactionbasicCommitTransactionbasicExecuteCallbasicRollbackTransactionbeginExternalTransactionbuildDefaultQueryBuildercheckAndRefreshInvalidObjectcheckHierarchyForDescriptorcleanUpInjectionManagerclearDescriptorsclearIntegrityCheckerclearLastDescriptorAccessedclearProfileclonecommitExternalTransactioncompareObjectscompareObjectsDontMatchconfigcontainsQuerycopycopycopyDescriptorNamedQueriescopyDescriptorsFromProjectcopyInternalcopyReadOnlyClassescreateCloneQueryValueHoldercreateCloneTransformationValueHoldercreateInjectionManagercreateProtectedInstanceFromCachedDatadeferEventdeleteAllObjectsdeleteObjectdoesObjectExistdontLogMessagesendOperationProfileendOperationProfileexecuteCallexecuteDeferredEventsexecuteNonSelectingCallexecuteNonSelectingSQLexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteSelectingCallexecuteSQLfinefinerfinestgetAccessorgetAccessorsgetAccessorsgetActiveCommandThreadsgetActiveSessiongetActiveUnitOfWorkgetAliasDescriptorsgetAllQueriesgetAttributeGroupsgetBrokergetCacheKeyFromTargetSessionForMergegetClassDescriptorgetClassDescriptorgetClassDescriptorForAliasgetCommandManagergetCommitManagergetDatasourceLogingetDatasourcePlatformgetDefaultReadOnlyClassesgetDefaultReferenceModegetDescriptorgetDescriptorgetDescriptorForAliasgetDescriptorsgetEventManagergetExceptionHandlergetExceptionHandlerClassgetExternalTransactionControllergetIdgetIdentityMapAccessorgetIdentityMapAccessorInstancegetInjectionManagergetIntegrityCheckergetJPAQueriesgetJPATablePerTenantQueriesgetLoadergetLoggetLogingetLogLevelgetLogLevelgetLogSessionStringgetMappedSuperclassgetMultitenantContextPropertiesgetNamegetNextQueryIdgetNextSequenceNumberValuegetNumberOfActiveUnitsOfWorkgetParentIdentityMapSessiongetParentIdentityMapSessiongetParentIdentityMapSessiongetPartitioningPolicygetPessimisticLockTimeoutDefaultgetPessimisticLockTimeoutUnitDefaultgetPlatformgetPlatformgetProfilergetProjectgetPropertiesgetPropertygetQueriesgetQuerygetQuerygetQuerygetQuerygetQueryBuildergetQueryTimeoutDefaultgetQueryTimeoutUnitDefaultgetRefreshMetadataListenergetRootSessiongetSequencinggetSerializergetSessionForClassgetSessionForNamegetSessionLoggetSessionTypeStringgetStaticMetamodelClassgetTablePerTenantDescriptorsgetTablePerTenantQueriesgetTransactionMutexhandleExceptionhandleSeverehasBrokerhasCommitManagerhasDescriptorhasEventManagerhasExceptionHandlerhasExternalTransactionControllerhasPropertieshasTablePerTenantDescriptorshasTablePerTenantQueriesincrementProfileincrementProfileinfoinitializeIdentityMapAccessorinsertObjectisBrokerisClassReadOnlyisClassReadOnlyisClientSessionisConcurrentisConnectedisConsideredInvalidisDatabaseSessionisDistributedSessionisExclusiveConnectionRequiredisExclusiveIsolatedClientSessionisFinalizersEnabledisInBrokerisInProfileisIsolatedClientSessionisJPAQueriesProcessedisLoggingOffisProtectedSessionisRemoteSessionisRemoteUnitOfWorkisServerSessionisSessionBrokerisSynchronizedisUnitOfWorkkeyFromObjectloadloadlogloglogloglogloglogloglogMessagelogMessagelogThrowablepostAcquireConnectionpreReleaseConnectionpriviledgedExecuteNonSelectingCallpriviledgedExecuteSelectingCallprocessCommandprocessJPAQueriesprocessJPAQueryreadAllObjectsreadAllObjectsreadAllObjectsreadAllObjectsreadObjectreadObjectreadObjectreadObjectreadObjectrefreshAndLockObjectrefreshAndLockObjectrefreshObjectregisterFinalizerreleasereleaseConnectionAfterCallreleaseJTSConnectionreleaseReadConnectionreleaseUnitOfWorkremovePropertyremoveQueryremoveQueryretrieveCacheKeyretryQueryretryTransactionrollbackExternalTransactionsetAccessorsetBrokersetCommandManagersetCommitManagersetDatasourceLoginsetDefaultReferenceModesetEventManagersetExceptionHandlersetExternalTransactionControllersetInjectionManagersetIntegrityCheckersetIsConcurrentsetIsFinalizersEnabledsetIsInBrokersetIsInProfilesetJPAQueriesProcessedsetLogsetLoggingOffsetLoginsetLoginsetLogLevelsetNamesetNumberOfActiveUnitsOfWorksetPartitioningPolicysetPessimisticLockTimeoutDefaultsetPessimisticLockTimeoutUnitDefaultsetProfilersetProjectsetPropertiessetPropertysetQueriessetQueryBuildersetQueryTimeoutDefaultsetQueryTimeoutUnitDefaultsetRefreshMetadataListenersetSerializersetSessionLogsetShouldOptimizeResultSetAccesssetShouldPropagateChangessetSynchronizedsetTolerateInvalidJPQLsetTransactionMutexsetWasJTSTransactionInternallyStartedsevereshouldDisplayDatashouldLogshouldLogMessagesshouldLogMessagesshouldOptimizeResultSetAccessshouldPropagateChangesshouldTolerateInvalidJPQLstartOperationProfilestartOperationProfileunwrapObjectupdateObjectupdateProfileupdateTablePerTenantDescriptorsvalidateCachevalidateQueryverifyDeletewarningwasJTSTransactionInternallyStartedwrapObjectwriteAllObjectsWithChangeSetwriteObjectwritesCompleted

Field Detail

asOfClauseback to summary
protected final AsOfClause asOfClause
parentback to summary
protected final AbstractSession parent

Constructor Detail

HistoricalSessionback to summary
public HistoricalSession(AbstractSession parent, AsOfClause clause)

INTERNAL: Create and return a new Historical Session.

Method Detail

acquireHistoricalSessionback to summary
public Session acquireHistoricalSession(AsOfClause clause) throws ValidationException

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.acquireHistoricalSession.

Implements org.eclipse.persistence.sessions.Session.acquireHistoricalSession.

INTERNAL: Acquires a special historical session for reading objects as of a past time.

Parameters
clause:AsOfClause

Doc from org.eclipse.persistence.sessions.Session.acquireHistoricalSession.

Represents a valid snap shot time.

Annotations
@Override
acquireUnitOfWorkback to summary
public UnitOfWorkImpl acquireUnitOfWork()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.acquireUnitOfWork.

Implements org.eclipse.persistence.sessions.Session.acquireUnitOfWork.

INTERNAL: A UnitOfWork can not be acquired from a Historical Session.

Annotations
@Override
beginTransactionback to summary
public void beginTransaction() throws DatabaseException, ConcurrencyException

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.beginTransaction.

INTERNAL: No transactions should be used inside a HistoricalSession.

Annotations
@Override
Exceptions
DatabaseException:

Doc from org.eclipse.persistence.internal.sessions.AbstractSession.beginTransaction.

if the database connection is lost or the begin is rejected.

ConcurrencyException:

Doc from org.eclipse.persistence.internal.sessions.AbstractSession.beginTransaction.

if this session's transaction is acquired by another thread and a timeout occurs.

commitTransactionback to summary
public void commitTransaction() throws DatabaseException, ConcurrencyException

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.commitTransaction.

INTERNAL: No transactions should be used inside a HistoricalSession.

Annotations
@Override
Exceptions
DatabaseException:

Doc from org.eclipse.persistence.internal.sessions.AbstractSession.commitTransaction.

most databases validate changes as they are done, normally errors do not occur on commit unless the disk fails or the connection is lost.

ConcurrencyException:

Doc from org.eclipse.persistence.internal.sessions.AbstractSession.commitTransaction.

if this session is not within a transaction.

getAsOfClauseback to summary
public AsOfClause getAsOfClause()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.getAsOfClause.

Implements org.eclipse.persistence.sessions.Session.getAsOfClause.

ADVANCED: Answers a read-only data object, which knows whether it is a wall-clock time or a system change number.

Returns:AsOfClause

Doc from org.eclipse.persistence.internal.sessions.AbstractSession.getAsOfClause.

An immutable object representation of the past time. null if no clause set, or this a regular session.

Annotations
@Override
getAsOfValueback to summary
public Object getAsOfValue()

PUBLIC: Answers the value this Session is As Of. Equivalent to getAsOfClause().getValue().

getExecutionSessionback to summary
public AbstractSession getExecutionSession(DatabaseQuery query)

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.getExecutionSession.

INTERNAL: Gets the session which this query will be executed on. Generally will be called immediately before the call is translated, which is immediately before session.executeCall.

Since the execution session also knows the correct datasource platform to execute on, it is often used in the mappings where the platform is needed for type conversion, or where calls are translated.

Is also the session with the accessor. Will return a ClientSession if it is in transaction and has a write connection.

Parameters
query:DatabaseQuery

may store session name or reference class for brokers case

Returns:AbstractSession

a session with a live accessor

Annotations
@Override
getParentback to summary
public AbstractSession getParent()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.getParent.

INTERNAL: Returns the parent Session.

Annotations
@Override
getServerPlatformback to summary
public ServerPlatform getServerPlatform()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.getServerPlatform.

Implements org.eclipse.persistence.sessions.Session.getServerPlatform.

INTERNAL: Marked internal as this is not customer API but helper methods for accessing the server platform from within TopLink's other sessions types (ie not DatabaseSession)

Annotations
@Override
hasAsOfClauseback to summary
public boolean hasAsOfClause()

ADVANCED: Answers if all objects are to be read as of a past time. Only true if this is a special historical session.

See Also
getAsOfClause
internalExecuteQueryback to summary
public Object internalExecuteQuery(DatabaseQuery query, AbstractRecord databaseRow) throws DatabaseException

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery.

INTERNAL: Return the results from executing the database query. the arguments should be a database row with raw data values. No modify queries are allowed through a HistoricalSession.

Annotations
@Override
isHistoricalSessionback to summary
public boolean isHistoricalSession()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.isHistoricalSession.

INTERNAL: Return if this session is a historical session.

Annotations
@Override
isInTransactionback to summary
public boolean isInTransaction()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.isInTransaction.

INTERNAL: Historical session are never in a transaction.

Annotations
@Override
prepareDatabaseQueryback to summary
public DatabaseQuery prepareDatabaseQuery(DatabaseQuery query)

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.prepareDatabaseQuery.

INTERNAL: A call back to do session specific preparation of a query.

The call back occurs immediately before we clone the query for execution, meaning that if this method needs to clone the query then the caller will determine that it doesn't need to clone the query twice.

Annotations
@Override
rollbackTransactionback to summary
public void rollbackTransaction() throws DatabaseException, ConcurrencyException

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.rollbackTransaction.

INTERNAL: No transactions should be used inside a HistoricalSession.

Annotations
@Override
Exceptions
DatabaseException:

Doc from org.eclipse.persistence.internal.sessions.AbstractSession.rollbackTransaction.

if the database connection is lost or the rollback fails.

ConcurrencyException:

Doc from org.eclipse.persistence.internal.sessions.AbstractSession.rollbackTransaction.

if this session is not within a transaction.

toStringback to summary
public String toString()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.toString.

Doc from org.eclipse.persistence.internal.sessions.AbstractSession.toString.

Print the connection status with the session.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object.

Annotations
@Override