public class HistoricalSession extends AbstractSession
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:
Session.acquireHistoricalSession(org.eclipse.persistence.history.AsOfClause)
,
Serialized FormLOG_DEBUG, LOG_ERROR, LOG_INFO, LOG_WARNING
Constructor and Description |
---|
HistoricalSession(AbstractSession parent,
AsOfClause clause)
INTERNAL:
Create and return a new Historical Session.
|
Modifier and Type | Method and Description |
---|---|
Session |
acquireHistoricalSession(AsOfClause clause)
INTERNAL:
Acquires a special historical session for reading objects as of a past time.
|
UnitOfWorkImpl |
acquireUnitOfWork()
INTERNAL:
A UnitOfWork can not be acquired from a Historical Session.
|
void |
beginTransaction()
INTERNAL:
No transactions should be used inside a HistoricalSession.
|
void |
commitTransaction()
INTERNAL:
No transactions should be used inside a HistoricalSession.
|
AsOfClause |
getAsOfClause()
ADVANCED:
Answers a read-only data object, which knows whether it is
a wall-clock time or a system change number.
|
java.lang.Object |
getAsOfValue()
PUBLIC:
Answers the value this Session is As Of.
|
AbstractSession |
getExecutionSession(DatabaseQuery query)
INTERNAL:
Gets the session which this query will be executed on.
|
AbstractSession |
getParent()
INTERNAL:
Returns the parent Session.
|
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)
|
boolean |
hasAsOfClause()
ADVANCED:
Answers if all objects are to be read as of a past time.
|
java.lang.Object |
internalExecuteQuery(DatabaseQuery query,
AbstractRecord databaseRow)
INTERNAL:
Return the results from executing the database query.
|
boolean |
isHistoricalSession()
INTERNAL:
Return if this session is a historical session.
|
boolean |
isInTransaction()
INTERNAL:
Historical session are never in a transaction.
|
DatabaseQuery |
prepareDatabaseQuery(DatabaseQuery query)
INTERNAL:
A call back to do session specific preparation of a query.
|
void |
rollbackTransaction()
INTERNAL:
No transactions should be used inside a HistoricalSession.
|
java.lang.String |
toString()
Print the connection status with the session.
|
acquireNonSynchronizedUnitOfWork, acquireNonSynchronizedUnitOfWork, acquireRepeatableWriteUnitOfWork, acquireUnitOfWork, addAlias, addJPAQuery, addJPATablePerTenantQuery, addMultitenantContextProperty, addQuery, addQuery, addStaticMetamodelClass, basicExecuteCall, beginExternalTransaction, checkAndRefreshInvalidObject, cleanUpEntityListenerInjectionManager, clearDescriptors, clearIntegrityChecker, clearLastDescriptorAccessed, clearProfile, clone, commitExternalTransaction, compareObjects, compareObjectsDontMatch, config, containsQuery, copy, copy, copyDescriptorNamedQueries, copyDescriptorsFromProject, copyInternal, copyObject, copyObject, copyReadOnlyClasses, createCloneQueryValueHolder, createCloneTransformationValueHolder, createEntityListenerInjectionManager, 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, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getCommandManager, getCommitManager, getDatasourceLogin, getDatasourcePlatform, getDefaultReadOnlyClasses, getDefaultReferenceMode, getDescriptor, getDescriptor, getDescriptorForAlias, getDescriptors, getEntityListenerInjectionManager, getEventManager, getExceptionHandler, getExceptionHandlerClass, getExternalTransactionController, getId, getIdentityMapAccessor, getIdentityMapAccessorInstance, getIntegrityChecker, getJPAQueries, getJPATablePerTenantQueries, getLoader, getLog, getLogin, getLogLevel, getLogLevel, getLogSessionString, getMappedSuperclass, getMultitenantContextProperties, getName, getNextQueryId, getNextSequenceNumberValue, getNumberOfActiveUnitsOfWork, getParentIdentityMapSession, getParentIdentityMapSession, getParentIdentityMapSession, getPartitioningPolicy, getPessimisticLockTimeoutDefault, getPlatform, getPlatform, getProfiler, getProject, getProperties, getProperty, getQueries, getQuery, getQuery, getQuery, getQuery, getQueryBuilder, getQueryTimeoutDefault, 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, readAllObjects, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, readObject, refreshAndLockObject, refreshAndLockObject, refreshObject, registerFinalizer, release, releaseConnectionAfterCall, releaseJTSConnection, releaseReadConnection, releaseUnitOfWork, removeProperty, removeQuery, removeQuery, retrieveCacheKey, retryQuery, retryTransaction, setAccessor, setBroker, setCommandManager, setCommitManager, setDatasourceLogin, setDefaultReferenceMode, setEntityListenerInjectionManager, setEventManager, setExceptionHandler, setExternalTransactionController, setIntegrityChecker, setIsConcurrent, setIsFinalizersEnabled, setIsInBroker, setIsInProfile, setJPAQueriesProcessed, setLog, setLoggingOff, setLogin, setLogin, setLogLevel, setName, setPartitioningPolicy, setPessimisticLockTimeoutDefault, setProfiler, setProject, setProperties, setProperty, setQueries, setQueryBuilder, setQueryTimeoutDefault, setRefreshMetadataListener, setSerializer, setSessionLog, setShouldOptimizeResultSetAccess, setShouldPropagateChanges, setSynchronized, setTolerateInvalidJPQL, setWasJTSTransactionInternallyStarted, severe, shouldDisplayData, shouldLog, shouldLogMessages, shouldLogMessages, shouldOptimizeResultSetAccess, shouldPropagateChanges, shouldTolerateInvalidJPQL, startOperationProfile, startOperationProfile, unwrapObject, updateObject, updateProfile, updateTablePerTenantDescriptors, validateCache, validateQuery, verifyDelete, warning, wasJTSTransactionInternallyStarted, wrapObject, writeObject, writesCompleted
public HistoricalSession(AbstractSession parent, AsOfClause clause)
public Session acquireHistoricalSession(AsOfClause clause) throws ValidationException
acquireHistoricalSession
in interface Session
acquireHistoricalSession
in class AbstractSession
clause
- Represents a valid snap shot time.ValidationException
- if this
not a ClientSession, plain Session, or SessionBroker.AsOfClause
,
Expression.asOf(org.eclipse.persistence.history.AsOfClause)
,
ObjectLevelReadQuery.setAsOfClause(org.eclipse.persistence.history.AsOfClause)
,
HistoryPolicy
public UnitOfWorkImpl acquireUnitOfWork()
acquireUnitOfWork
in interface Session
acquireUnitOfWork
in class AbstractSession
UnitOfWorkImpl
public void beginTransaction() throws DatabaseException, ConcurrencyException
beginTransaction
in class AbstractSession
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.AbstractSession.isInTransaction()
public void commitTransaction() throws DatabaseException, ConcurrencyException
commitTransaction
in class AbstractSession
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.public AbstractSession getExecutionSession(DatabaseQuery query)
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.
getExecutionSession
in class AbstractSession
query
- may store session name or reference class for brokers casepublic AsOfClause getAsOfClause()
getAsOfClause
in interface Session
getAsOfClause
in class AbstractSession
null
if no clause set, or this a regular session.AbstractSession.acquireHistoricalSession(org.eclipse.persistence.history.AsOfClause)
public java.lang.Object getAsOfValue()
public AbstractSession getParent()
getParent
in class AbstractSession
public ServerPlatform getServerPlatform()
getServerPlatform
in interface Session
getServerPlatform
in class AbstractSession
public boolean hasAsOfClause()
getAsOfClause()
public java.lang.Object internalExecuteQuery(DatabaseQuery query, AbstractRecord databaseRow) throws DatabaseException
internalExecuteQuery
in class AbstractSession
DatabaseException
public boolean isInTransaction()
isInTransaction
in class AbstractSession
public boolean isHistoricalSession()
isHistoricalSession
in class AbstractSession
public DatabaseQuery prepareDatabaseQuery(DatabaseQuery 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.
prepareDatabaseQuery
in class AbstractSession
public void rollbackTransaction() throws DatabaseException, ConcurrencyException
rollbackTransaction
in class AbstractSession
DatabaseException
- if the database connection is lost or the rollback fails.ConcurrencyException
- if this session is not within a transaction.public java.lang.String toString()
AbstractSession
toString
in class AbstractSession
EclipseLink 2.6.3, "build v20160428-59c81c5" API Reference