Module org.eclipse.persistence.core
Class HistoricalSession
java.lang.Object
org.eclipse.persistence.internal.core.sessions.CoreAbstractSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>
org.eclipse.persistence.internal.sessions.AbstractSession
org.eclipse.persistence.internal.history.HistoricalSession
- All Implemented Interfaces:
Serializable
,Cloneable
,CoreSession<ClassDescriptor,
,Login, Platform, Project, SessionEventManager> CommandProcessor
,Session
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:- Execute all read queries as of a past time.
- Insure that all objects read are cached in an Identity map completely isolated from that of its parent.
- Once a query has been uniquely prepared to read past objects, execute the call on the parent session.
- Since:
- OracleAS TopLink 10g (10.1.3)
- See Also:
-
Field Summary
Fields inherited from class org.eclipse.persistence.internal.sessions.AbstractSession
accessors, activeCommandThreads, attributeGroups, broker, commandManager, commitManager, defaultReferenceMode, deferredEvents, descriptors, eventManager, exceptionHandler, externalTransactionController, identityMapAccessor, injectionManager, integrityChecker, isConcurrent, isExecutingEvents, isFinalizersEnabled, isInBroker, isInProfile, isLoggingOff, isSynchronized, jpaQueriesProcessed, lastDescriptorAccessed, logSessionString, metadatalistener, multitenantContextProperties, name, numberOfActiveUnitsOfWork, objectsLockedForClone, partitioningPolicy, pessimisticLockTimeoutDefault, pessimisticLockTimeoutUnitDefault, platform, profiler, project, properties, queries, queryBuilder, queryTimeoutDefault, queryTimeoutUnitDefault, serializer, sessionLog, shouldCheckWriteLock, shouldOptimizeResultSetAccess, shouldPropagateChanges, staticMetamodelClasses, tablePerTenantDescriptors, tablePerTenantQueries, tolerateInvalidJPQL, transactionMutex, wasJTSTransactionInternallyStarted
Fields inherited from interface org.eclipse.persistence.sessions.coordination.CommandProcessor
LOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING
-
Constructor Summary
ConstructorDescriptionHistoricalSession
(AbstractSession parent, AsOfClause clause) INTERNAL: Create and return a new Historical Session. -
Method Summary
Modifier and TypeMethodDescriptionacquireHistoricalSession
(AsOfClause clause) INTERNAL: Acquires a special historical session for reading objects as of a past time.INTERNAL: A UnitOfWork can not be acquired from a Historical Session.void
INTERNAL: No transactions should be used inside a HistoricalSession.void
INTERNAL: No transactions should be used inside a HistoricalSession.ADVANCED: Answers a read-only data object, which knows whether it is a wall-clock time or a system change number.PUBLIC: Answers the value this Session is As Of.getExecutionSession
(DatabaseQuery query) INTERNAL: Gets the session which this query will be executed on.INTERNAL: Returns the parent Session.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)boolean
ADVANCED: Answers if all objects are to be read as of a past time.internalExecuteQuery
(DatabaseQuery query, AbstractRecord databaseRow) INTERNAL: Return the results from executing the database query.boolean
INTERNAL: Return if this session is a historical session.boolean
INTERNAL: Historical session are never in a transaction.INTERNAL: A call back to do session specific preparation of a query.void
INTERNAL: No transactions should be used inside a HistoricalSession.toString()
Print the connection status with the session.Methods inherited from class org.eclipse.persistence.internal.sessions.AbstractSession
acquireNonSynchronizedUnitOfWork, acquireNonSynchronizedUnitOfWork, acquireRepeatableWriteUnitOfWork, acquireUnitOfWork, addAlias, addJPAQuery, addJPATablePerTenantQuery, addMultitenantContextProperty, addQuery, addQuery, addQuery, addStaticMetamodelClass, addTablePerTenantDescriptor, addTablePerTenantQuery, basicBeginTransaction, basicBeginTransaction, basicCommitTransaction, basicExecuteCall, basicRollbackTransaction, beginExternalTransaction, buildDefaultQueryBuilder, checkAndRefreshInvalidObject, checkHierarchyForDescriptor, cleanUpInjectionManager, clearDescriptors, clearIntegrityChecker, clearLastDescriptorAccessed, clearProfile, clone, commitExternalTransaction, compareObjects, compareObjectsDontMatch, config, containsQuery, copy, copy, copyDescriptorNamedQueries, copyDescriptorsFromProject, copyInternal, copyReadOnlyClasses, createCloneQueryValueHolder, createCloneTransformationValueHolder, createInjectionManager, createProtectedInstanceFromCachedData, deferEvent, deleteAllObjects, deleteObject, doesObjectExist, dontLogMessages, endOperationProfile, endOperationProfile, executeCall, executeDeferredEvents, executeNonSelectingCall, executeNonSelectingSQL, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeSelectingCall, executeSQL, fine, finer, finest, getAccessor, getAccessors, getAccessors, getActiveCommandThreads, getActiveSession, getActiveUnitOfWork, getAliasDescriptors, getAllQueries, getAttributeGroups, getBroker, getCacheKeyFromTargetSessionForMerge, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getCommandManager, getCommitManager, getDatasourceLogin, getDatasourcePlatform, getDefaultReadOnlyClasses, getDefaultReferenceMode, getDescriptor, getDescriptor, getDescriptorForAlias, getDescriptors, getEventManager, getExceptionHandler, getExceptionHandlerClass, getExternalTransactionController, getId, getIdentityMapAccessor, getIdentityMapAccessorInstance, getInjectionManager, getIntegrityChecker, getJPAQueries, getJPATablePerTenantQueries, getLoader, getLog, getLogin, getLogLevel, getLogLevel, getLogSessionString, getMappedSuperclass, getMultitenantContextProperties, getName, getNextQueryId, getNextSequenceNumberValue, getNumberOfActiveUnitsOfWork, getParentIdentityMapSession, getParentIdentityMapSession, getParentIdentityMapSession, getPartitioningPolicy, getPessimisticLockTimeoutDefault, getPessimisticLockTimeoutUnitDefault, getPlatform, getPlatform, getProfiler, getProject, getProperties, getProperty, getQueries, getQuery, getQuery, getQuery, getQuery, getQueryBuilder, getQueryTimeoutDefault, getQueryTimeoutUnitDefault, getRefreshMetadataListener, getRootSession, getSequencing, getSerializer, getSessionForClass, getSessionForName, getSessionLog, getSessionTypeString, getStaticMetamodelClass, getTablePerTenantDescriptors, getTablePerTenantQueries, getTransactionMutex, handleException, handleSevere, hasBroker, hasCommitManager, hasDescriptor, hasEventManager, hasExceptionHandler, hasExternalTransactionController, hasProperties, hasTablePerTenantDescriptors, hasTablePerTenantQueries, incrementProfile, incrementProfile, info, initializeIdentityMapAccessor, insertObject, isBroker, isClassReadOnly, isClassReadOnly, isClientSession, isConcurrent, isConnected, isConsideredInvalid, isDatabaseSession, isDistributedSession, isExclusiveConnectionRequired, isExclusiveIsolatedClientSession, isFinalizersEnabled, isInBroker, isInProfile, isIsolatedClientSession, isJPAQueriesProcessed, isLoggingOff, isProtectedSession, isRemoteSession, isRemoteUnitOfWork, isServerSession, isSessionBroker, isSynchronized, isUnitOfWork, keyFromObject, load, load, log, log, log, log, log, log, log, log, logMessage, logMessage, logThrowable, postAcquireConnection, preReleaseConnection, priviledgedExecuteNonSelectingCall, priviledgedExecuteSelectingCall, processCommand, processJPAQueries, processJPAQuery, readAllObjects, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, readObject, refreshAndLockObject, refreshAndLockObject, refreshObject, registerFinalizer, release, releaseConnectionAfterCall, releaseJTSConnection, releaseReadConnection, releaseUnitOfWork, removeProperty, removeQuery, removeQuery, retrieveCacheKey, retryQuery, retryTransaction, rollbackExternalTransaction, setAccessor, setBroker, setCommandManager, setCommitManager, setDatasourceLogin, setDefaultReferenceMode, setEventManager, setExceptionHandler, setExternalTransactionController, setInjectionManager, setIntegrityChecker, setIsConcurrent, setIsFinalizersEnabled, setIsInBroker, setIsInProfile, setJPAQueriesProcessed, setLog, setLoggingOff, setLogin, setLogin, setLogLevel, setName, setNumberOfActiveUnitsOfWork, setPartitioningPolicy, setPessimisticLockTimeoutDefault, setPessimisticLockTimeoutUnitDefault, setProfiler, setProject, setProperties, setProperty, setQueries, setQueryBuilder, setQueryTimeoutDefault, setQueryTimeoutUnitDefault, setRefreshMetadataListener, setSerializer, setSessionLog, setShouldOptimizeResultSetAccess, setShouldPropagateChanges, setSynchronized, setTolerateInvalidJPQL, setTransactionMutex, setWasJTSTransactionInternallyStarted, severe, shouldDisplayData, shouldLog, shouldLogMessages, shouldLogMessages, shouldOptimizeResultSetAccess, shouldPropagateChanges, shouldTolerateInvalidJPQL, startOperationProfile, startOperationProfile, unwrapObject, updateObject, updateProfile, updateTablePerTenantDescriptors, validateCache, validateQuery, verifyDelete, warning, wasJTSTransactionInternallyStarted, wrapObject, writeAllObjectsWithChangeSet, writeObject, writesCompleted
-
Field Details
-
parent
-
asOfClause
-
-
Constructor Details
-
HistoricalSession
INTERNAL: Create and return a new Historical Session.
-
-
Method Details
-
acquireHistoricalSession
INTERNAL: Acquires a special historical session for reading objects as of a past time.- Specified by:
acquireHistoricalSession
in interfaceSession
- Overrides:
acquireHistoricalSession
in classAbstractSession
- Parameters:
clause
- Represents a valid snap shot time.- Throws:
ValidationException
- ifthis
not a ClientSession, plain Session, or SessionBroker.- See Also:
-
acquireUnitOfWork
INTERNAL: A UnitOfWork can not be acquired from a Historical Session.- Specified by:
acquireUnitOfWork
in interfaceSession
- Overrides:
acquireUnitOfWork
in classAbstractSession
- See Also:
-
beginTransaction
INTERNAL: No transactions should be used inside a HistoricalSession.- Overrides:
beginTransaction
in classAbstractSession
- Throws:
DatabaseException
- if the database connection is lost or the begin is rejected.ConcurrencyException
- if this session's transaction is acquired by another thread and a timeout occurs.- See Also:
-
commitTransaction
INTERNAL: No transactions should be used inside a HistoricalSession.- Overrides:
commitTransaction
in classAbstractSession
- Throws:
DatabaseException
- 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
- if this session is not within a transaction.
-
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.
- Overrides:
getExecutionSession
in classAbstractSession
- Parameters:
query
- may store session name or reference class for brokers case- Returns:
- a session with a live accessor
-
getAsOfClause
ADVANCED: Answers a read-only data object, which knows whether it is a wall-clock time or a system change number.- Specified by:
getAsOfClause
in interfaceSession
- Overrides:
getAsOfClause
in classAbstractSession
- Returns:
- An immutable object representation of the past time.
null
if no clause set, or this a regular session. - See Also:
-
getAsOfValue
PUBLIC: Answers the value this Session is As Of. Equivalent to getAsOfClause().getValue(). -
getParent
INTERNAL: Returns the parent Session.- Overrides:
getParent
in classAbstractSession
-
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)- Specified by:
getServerPlatform
in interfaceSession
- Overrides:
getServerPlatform
in classAbstractSession
-
hasAsOfClause
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:
-
internalExecuteQuery
public Object internalExecuteQuery(DatabaseQuery query, AbstractRecord databaseRow) throws DatabaseException 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.- Overrides:
internalExecuteQuery
in classAbstractSession
- Throws:
DatabaseException
-
isInTransaction
public boolean isInTransaction()INTERNAL: Historical session are never in a transaction.- Overrides:
isInTransaction
in classAbstractSession
-
isHistoricalSession
public boolean isHistoricalSession()INTERNAL: Return if this session is a historical session.- Overrides:
isHistoricalSession
in classAbstractSession
-
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.
- Overrides:
prepareDatabaseQuery
in classAbstractSession
-
rollbackTransaction
INTERNAL: No transactions should be used inside a HistoricalSession.- Overrides:
rollbackTransaction
in classAbstractSession
- Throws:
DatabaseException
- if the database connection is lost or the rollback fails.ConcurrencyException
- if this session is not within a transaction.
-
toString
Description copied from class:AbstractSession
Print the connection status with the session.- Overrides:
toString
in classAbstractSession
-