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:
java.io.Serializable,java.lang.Cloneable,CoreSession<ClassDescriptor,Login,Platform,Project,SessionEventManager>,CommandProcessor,Session
public class HistoricalSession extends AbstractSession
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)
- Author:
- Stephen McRitchie
- See Also:
Session.acquireHistoricalSession(org.eclipse.persistence.history.AsOfClause), Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AsOfClauseasOfClauseprotected AbstractSessionparent-
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
Constructors Constructor Description HistoricalSession(AbstractSession parent, AsOfClause clause)INTERNAL: Create and return a new Historical Session.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SessionacquireHistoricalSession(AsOfClause clause)INTERNAL: Acquires a special historical session for reading objects as of a past time.UnitOfWorkImplacquireUnitOfWork()INTERNAL: A UnitOfWork can not be acquired from a Historical Session.voidbeginTransaction()INTERNAL: No transactions should be used inside a HistoricalSession.voidcommitTransaction()INTERNAL: No transactions should be used inside a HistoricalSession.AsOfClausegetAsOfClause()ADVANCED: Answers a read-only data object, which knows whether it is a wall-clock time or a system change number.java.lang.ObjectgetAsOfValue()PUBLIC: Answers the value this Session is As Of.AbstractSessiongetExecutionSession(DatabaseQuery query)INTERNAL: Gets the session which this query will be executed on.AbstractSessiongetParent()INTERNAL: Returns the parent Session.ServerPlatformgetServerPlatform()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)booleanhasAsOfClause()ADVANCED: Answers if all objects are to be read as of a past time.java.lang.ObjectinternalExecuteQuery(DatabaseQuery query, AbstractRecord databaseRow)INTERNAL: Return the results from executing the database query.booleanisHistoricalSession()INTERNAL: Return if this session is a historical session.booleanisInTransaction()INTERNAL: Historical session are never in a transaction.DatabaseQueryprepareDatabaseQuery(DatabaseQuery query)INTERNAL: A call back to do session specific preparation of a query.voidrollbackTransaction()INTERNAL: No transactions should be used inside a HistoricalSession.java.lang.StringtoString()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, copyObject, copyObject, copyReadOnlyClasses, createCloneQueryValueHolder, createCloneTransformationValueHolder, createInjectionManager, createProtectedInstanceFromCachedData, deferEvent, deleteAllObjects, 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, keyFromObject, load, load, log, log, 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 Detail
-
parent
protected final AbstractSession parent
-
asOfClause
protected final AsOfClause asOfClause
-
-
Constructor Detail
-
HistoricalSession
public HistoricalSession(AbstractSession parent, AsOfClause clause)
INTERNAL: Create and return a new Historical Session.
-
-
Method Detail
-
acquireHistoricalSession
public Session acquireHistoricalSession(AsOfClause clause) throws ValidationException
INTERNAL: Acquires a special historical session for reading objects as of a past time.- Specified by:
acquireHistoricalSessionin interfaceSession- Overrides:
acquireHistoricalSessionin classAbstractSession- Parameters:
clause- Represents a valid snap shot time.- Throws:
ValidationException- ifthisnot a ClientSession, plain Session, or SessionBroker.- See Also:
AsOfClause,Expression.asOf(org.eclipse.persistence.history.AsOfClause),ObjectLevelReadQuery.setAsOfClause(org.eclipse.persistence.history.AsOfClause),HistoryPolicy
-
acquireUnitOfWork
public UnitOfWorkImpl acquireUnitOfWork()
INTERNAL: A UnitOfWork can not be acquired from a Historical Session.- Specified by:
acquireUnitOfWorkin interfaceSession- Overrides:
acquireUnitOfWorkin classAbstractSession- See Also:
UnitOfWorkImpl
-
beginTransaction
public void beginTransaction() throws DatabaseException, ConcurrencyExceptionINTERNAL: No transactions should be used inside a HistoricalSession.- Overrides:
beginTransactionin 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:
AbstractSession.isInTransaction()
-
commitTransaction
public void commitTransaction() throws DatabaseException, ConcurrencyExceptionINTERNAL: No transactions should be used inside a HistoricalSession.- Overrides:
commitTransactionin 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
public AbstractSession getExecutionSession(DatabaseQuery query)
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:
getExecutionSessionin classAbstractSession- Parameters:
query- may store session name or reference class for brokers case- Returns:
- a session with a live accessor
-
getAsOfClause
public AsOfClause getAsOfClause()
ADVANCED: Answers a read-only data object, which knows whether it is a wall-clock time or a system change number.- Specified by:
getAsOfClausein interfaceSession- Overrides:
getAsOfClausein classAbstractSession- Returns:
- An immutable object representation of the past time.
nullif no clause set, or this a regular session. - See Also:
AbstractSession.acquireHistoricalSession(org.eclipse.persistence.history.AsOfClause)
-
getAsOfValue
public java.lang.Object getAsOfValue()
PUBLIC: Answers the value this Session is As Of. Equivalent to getAsOfClause().getValue().
-
getParent
public AbstractSession getParent()
INTERNAL: Returns the parent Session.- Overrides:
getParentin classAbstractSession
-
getServerPlatform
public ServerPlatform 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:
getServerPlatformin interfaceSession- Overrides:
getServerPlatformin 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:
getAsOfClause()
-
internalExecuteQuery
public java.lang.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:
internalExecuteQueryin classAbstractSession- Throws:
DatabaseException
-
isInTransaction
public boolean isInTransaction()
INTERNAL: Historical session are never in a transaction.- Overrides:
isInTransactionin classAbstractSession
-
isHistoricalSession
public boolean isHistoricalSession()
INTERNAL: Return if this session is a historical session.- Overrides:
isHistoricalSessionin classAbstractSession
-
prepareDatabaseQuery
public DatabaseQuery prepareDatabaseQuery(DatabaseQuery query)
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:
prepareDatabaseQueryin classAbstractSession
-
rollbackTransaction
public void rollbackTransaction() throws DatabaseException, ConcurrencyExceptionINTERNAL: No transactions should be used inside a HistoricalSession.- Overrides:
rollbackTransactionin classAbstractSession- Throws:
DatabaseException- if the database connection is lost or the rollback fails.ConcurrencyException- if this session is not within a transaction.
-
toString
public java.lang.String toString()
Description copied from class:AbstractSessionPrint the connection status with the session.- Overrides:
toStringin classAbstractSession
-
-