Class SessionBroker
- java.lang.Object
-
- org.eclipse.persistence.internal.core.sessions.CoreAbstractSession<ClassDescriptor,Login,org.eclipse.persistence.internal.databaseaccess.Platform,Project,SessionEventManager>
-
- org.eclipse.persistence.internal.sessions.AbstractSession
-
- org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
-
- org.eclipse.persistence.sessions.broker.SessionBroker
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,CoreSession<ClassDescriptor,Login,org.eclipse.persistence.internal.databaseaccess.Platform,Project,SessionEventManager>,CommandProcessor,DatabaseSession,Session
public class SessionBroker extends org.eclipse.persistence.internal.sessions.DatabaseSessionImplPurpose: Provide a single view to a TopLink session that transparently accesses multple databases.
Responsibilities:
- Broker queries to the appropriate child sessions.
- Use a simplified two-stage commit policy on commit of transaction.
- Support brokered units of work.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected SessionBrokerparentprotected org.eclipse.persistence.internal.sequencing.Sequencingsequencingprotected java.util.Map<java.lang.Class,java.lang.String>sessionNamesByClassprotected java.util.Map<java.lang.String,org.eclipse.persistence.internal.sessions.AbstractSession>sessionsByNameprotected booleanshouldUseDescriptorAliases-
Fields inherited from class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
connectedTime, databaseEventListener, isLoggedIn, sequencingHome, serverPlatform, tuner
-
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 Modifier Constructor Description SessionBroker()PUBLIC: Create and return a session broker.protectedSessionBroker(java.util.Map sessionNames)INTERNAL: Create and return a session broker.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SessionBrokeracquireClientSessionBroker()PUBLIC: Return a session broker that behaves as a client session broker.SessionBrokeracquireClientSessionBroker(java.util.Map<java.lang.String,ConnectionPolicy> connectionPolicies, java.util.Map mapOfProperties)PUBLIC: Return a session broker that behaves as a client session broker.SessionacquireHistoricalSession(AsOfClause clause)INTERNAL: Acquires a special historical session for reading objects as of a past time.org.eclipse.persistence.internal.sessions.UnitOfWorkImplacquireUnitOfWork()PUBLIC: Return a unit of work for this session broker.voidaddDescriptor(ClassDescriptor descriptor)PUBLIC: You cannot add a descriptor to a session broker, you must add it to its session.voidaddDescriptors(java.util.Vector descriptors)PUBLIC: You cannot add descriptors to a session broker, you must add them to its session.voidaddDescriptors(Project project)PUBLIC: You cannot add a project to a session broker, you must add it to its session.voidaddSequence(Sequence sequence)PUBLIC: You cannot add a sequence to a session broker, you must add it to its session.protected voidbasicBeginTransaction()INTERNAL: Begin the transaction on all child sessions.protected voidbasicCommitTransaction()INTERNAL: Commit the transaction on all child sessions.protected voidbasicRollbackTransaction()INTERNAL: Rollback the transaction on all child sessions.booleancontainsQuery(java.lang.String queryName)PUBLIC: Return true if the pre-defined query is defined on the session.protected SessionBrokercopySessionBroker()INTERNAL: Return a copy (not using clone) of a session broker.java.util.Collection<org.eclipse.persistence.internal.databaseaccess.Accessor>getAccessors(Call call, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, DatabaseQuery query)INTERNAL: Return the low-level database accessors.AsOfClausegetAsOfClause()ADVANCED: Answers the past time this session is as of.org.eclipse.persistence.internal.sessions.AbstractSessiongetExecutionSession(DatabaseQuery query)INTERNAL: Gets the session which this query will be executed on.SessionBrokergetParent()INTERNAL: Gets the parent SessionBroker.org.eclipse.persistence.internal.databaseaccess.PlatformgetPlatform(java.lang.Class domainClass)INTERNAL: Return the platform for a particular class.DatabaseQuerygetQuery(java.lang.String name, java.util.Vector arguments, boolean shouldSearchParent)PUBLIC: Return the query from the session pre-defined queries with the given name and argument types.org.eclipse.persistence.internal.sequencing.SequencinggetSequencing()PUBLIC: Return the Sequencing object used by the session.protected org.eclipse.persistence.internal.sequencing.SequencingHomegetSequencingHome()PROTECTED: Session broker doesn't have SequencingHome.org.eclipse.persistence.internal.sessions.AbstractSessiongetSessionForClass(java.lang.Class domainClass)INTERNAL: Return the session to be used for the class.org.eclipse.persistence.internal.sessions.AbstractSessiongetSessionForName(java.lang.String name)INTERNAL: Return the session by name.protected org.eclipse.persistence.internal.sessions.AbstractSessiongetSessionForQuery(DatabaseQuery query)INTERNAL: Answers the session to be used for the given query.protected java.util.Map<java.lang.Class,java.lang.String>getSessionNamesByClass()INTERNAL: Return sessions indexed by class, each class can only have one default session.java.util.Map<java.lang.String,org.eclipse.persistence.internal.sessions.AbstractSession>getSessionsByName()INTERNAL: Return sessions indexed by name.inthowManySequencingCallbacks()INTERNAL: Returns a number of member sessions that require sequencing callback.voidinitializeDescriptors()INTERNAL: Allow each descriptor to initialize any dependencies on this session.voidinitializeIdentityMapAccessor()INTERNAL: Set up the IdentityMapManager.voidinitializeSequencing()ADVANCED: Creates sequencing object for the session broker.java.lang.ObjectinternalExecuteQuery(DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractRecord row)INTERNAL: Return the results from exeucting the database query.booleanisBroker()INTERNAL: Returns true if the session is a session Broker.booleanisClientSessionBroker()PUBLIC: Return if this session is a client session broker.booleanisConnected()PUBLIC: Return if all sessions are still connected to the database.booleanisSequencingCallbackRequired()INTERNAL: Indicates whether SequencingCallback is required.booleanisServerSessionBroker()PUBLIC: Return if this session is a server session broker.booleanisSessionBroker()INTERNAL: Return if this session is a session broker.voidlogin()PUBLIC: Connect to the database using the predefined login.voidlogin(java.lang.String userName, java.lang.String password)PUBLIC: Connect to the database using the predefined login.voidloginAndDetectDatasource()PUBLIC: Connect to the database using the predefined login.voidlogout()PUBLIC: Disconnect from all databases.voidpostLogin()INTERNAL: Rise postLogin events for member sessions and the SessionBroker.voidregisterSession(java.lang.String name, org.eclipse.persistence.internal.sessions.AbstractSession session)PUBLIC: Register the session under its name.voidregisterSession(java.lang.String name, Session session)PUBLIC: Register the session under its name.voidrelease()PUBLIC: Release the session.voidreleaseJTSConnection()INTERNAL: Called in the end of beforeCompletion of external transaction sychronization listener.java.lang.ObjectretryQuery(DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractRecord row, DatabaseException databaseException, int retryCount, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)INTERNAL: A query execution failed due to an invalid query.voidsetExternalTransactionController(ExternalTransactionController externalTransactionController)INTERNAL: Used for JTS integration internally by ServerPlatform.voidsetIntegrityChecker(IntegrityChecker integrityChecker)PUBLIC: set the integrityChecker.voidsetLog(java.io.Writer log)PUBLIC: Set the message log.voidsetProfiler(SessionProfiler profiler)PUBLIC: Set the profiler for the session.voidsetSessionLog(SessionLog log)PUBLIC: Set the session log.protected voidsetSessionNameByClass(java.util.HashMap sessionNameByClass)INTERNAL: Set sessions indexed by class, each class can only have one default session.voidsetSessionsByName(java.util.Map sessionsByName)INTERNAL: Set sessions indexed by name.voidsetShouldUseDescriptorAliases(boolean shouldUseDescriptorAliases)PUBLIC: Indicates whether descriptors should use aliasDescriptors map.voidsetSynchronized(boolean synched)INTERNAL: Set isSynchronized flag to indicate that members of session broker are synchronized.booleanshouldUseDescriptorAliases()PUBLIC: Indicates whether descriptors should use aliasDescriptors map.voidwritesCompleted()INTERNAL: This method notifies the accessor that a particular sets of writes has completed.-
Methods inherited from class org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
addDescriptors, addDescriptorsToSequencing, connect, disconnect, finalize, getConnectedTime, getDatabaseEventListener, getDatasourcePlatform, getPlatform, getReadLogin, getSequencingControl, getServerPlatform, getTuner, initializeConnectedTime, initializeDescriptorIfSessionAlive, initializeDescriptors, initializeDescriptors, initializeDescriptors, initializeDescriptors, isDatabaseSession, isLoggedIn, isProtectedSession, login, postConnectDatasource, preConnectDatasource, setDatabaseEventListener, setDatasourceAndInitialize, setOrDetectDatasource, setSequencingHome, setServerPlatform, setTuner, writeAllObjects, writeAllObjects
-
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, basicExecuteCall, beginExternalTransaction, beginTransaction, buildDefaultQueryBuilder, checkAndRefreshInvalidObject, checkHierarchyForDescriptor, cleanUpInjectionManager, clearDescriptors, clearIntegrityChecker, clearLastDescriptorAccessed, clearProfile, clone, commitExternalTransaction, commitTransaction, compareObjects, compareObjectsDontMatch, config, 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, getActiveCommandThreads, getActiveSession, getActiveUnitOfWork, getAliasDescriptors, getAllQueries, getAttributeGroups, getBroker, getCacheKeyFromTargetSessionForMerge, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getCommandManager, getCommitManager, getDatasourceLogin, 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, getProfiler, getProject, getProperties, getProperty, getQueries, getQuery, getQuery, getQuery, getQueryBuilder, getQueryTimeoutDefault, getQueryTimeoutUnitDefault, getRefreshMetadataListener, getRootSession, getSerializer, getSessionLog, getSessionTypeString, getStaticMetamodelClass, getTablePerTenantDescriptors, getTablePerTenantQueries, getTransactionMutex, handleException, handleSevere, hasBroker, hasCommitManager, hasDescriptor, hasEventManager, hasExceptionHandler, hasExternalTransactionController, hasProperties, hasTablePerTenantDescriptors, hasTablePerTenantQueries, incrementProfile, incrementProfile, info, insertObject, isClassReadOnly, isClassReadOnly, isClientSession, isConcurrent, isConsideredInvalid, isDistributedSession, isExclusiveConnectionRequired, isExclusiveIsolatedClientSession, isFinalizersEnabled, isHistoricalSession, isInBroker, isInProfile, isInTransaction, isIsolatedClientSession, isJPAQueriesProcessed, isLoggingOff, isRemoteSession, isRemoteUnitOfWork, isServerSession, isSynchronized, isUnitOfWork, keyFromObject, keyFromObject, load, load, log, log, log, log, log, log, log, log, log, log, logMessage, logMessage, logThrowable, postAcquireConnection, prepareDatabaseQuery, preReleaseConnection, priviledgedExecuteNonSelectingCall, priviledgedExecuteSelectingCall, processCommand, processJPAQueries, processJPAQuery, readAllObjects, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, readObject, refreshAndLockObject, refreshAndLockObject, refreshObject, registerFinalizer, releaseConnectionAfterCall, releaseReadConnection, releaseUnitOfWork, removeProperty, removeQuery, removeQuery, retrieveCacheKey, retryTransaction, rollbackExternalTransaction, rollbackTransaction, setAccessor, setBroker, setCommandManager, setCommitManager, setDatasourceLogin, setDefaultReferenceMode, setEventManager, setExceptionHandler, setInjectionManager, setIsConcurrent, setIsFinalizersEnabled, setIsInBroker, setIsInProfile, setJPAQueriesProcessed, setLoggingOff, setLogin, setLogin, setLogLevel, setName, setNumberOfActiveUnitsOfWork, setPartitioningPolicy, setPessimisticLockTimeoutDefault, setPessimisticLockTimeoutUnitDefault, setProject, setProperties, setProperty, setQueries, setQueryBuilder, setQueryTimeoutDefault, setQueryTimeoutUnitDefault, setRefreshMetadataListener, setSerializer, setShouldOptimizeResultSetAccess, setShouldPropagateChanges, setTolerateInvalidJPQL, setTransactionMutex, setWasJTSTransactionInternallyStarted, severe, shouldDisplayData, shouldLog, shouldLogMessages, shouldLogMessages, shouldOptimizeResultSetAccess, shouldPropagateChanges, shouldTolerateInvalidJPQL, startOperationProfile, startOperationProfile, toString, unwrapObject, updateObject, updateProfile, updateTablePerTenantDescriptors, validateCache, validateQuery, verifyDelete, warning, wasJTSTransactionInternallyStarted, wrapObject, writeAllObjectsWithChangeSet, writeObject
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.persistence.sessions.DatabaseSession
beginTransaction, commitTransaction, deleteAllObjects, deleteObject, getCommandManager, insertObject, isInTransaction, refreshAndLockObject, refreshAndLockObject, rollbackTransaction, setCommandManager, setDatasourceLogin, setLogin, setShouldPropagateChanges, shouldPropagateChanges, updateObject, writeObject
-
Methods inherited from interface org.eclipse.persistence.sessions.Session
acquireUnitOfWork, addJPAQuery, addQuery, clearIntegrityChecker, clearProfile, copy, copy, copyObject, copyObject, doesObjectExist, dontLogMessages, executeNonSelectingCall, executeNonSelectingSQL, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeSelectingCall, executeSQL, getActiveSession, getActiveUnitOfWork, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getDatasourceLogin, getDefaultReferenceMode, getDescriptor, getDescriptor, getDescriptorForAlias, getDescriptors, getEventManager, getExceptionHandler, getExternalTransactionController, getId, getIdentityMapAccessor, getIntegrityChecker, getJPAQueries, getLog, getLogin, getLogLevel, getLogLevel, getName, getNextSequenceNumberValue, getPartitioningPolicy, getProfiler, getProject, getProperties, getProperty, getQueries, getQuery, getQuery, getSerializer, getSessionLog, handleException, handleSevere, hasDescriptor, hasExceptionHandler, hasExternalTransactionController, isClientSession, isDistributedSession, isFinalizersEnabled, isInProfile, isRemoteSession, isRemoteUnitOfWork, isServerSession, isUnitOfWork, keyFromObject, log, logMessage, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, refreshObject, removeProperty, removeQuery, setDefaultReferenceMode, setExceptionHandler, setIsFinalizersEnabled, setLogLevel, setName, setPartitioningPolicy, setProperty, setQueryTimeoutDefault, setQueryTimeoutUnitDefault, setSerializer, shouldLog, shouldLogMessages, validateCache
-
-
-
-
Field Detail
-
parent
protected SessionBroker parent
-
sessionNamesByClass
protected java.util.Map<java.lang.Class,java.lang.String> sessionNamesByClass
-
sessionsByName
protected java.util.Map<java.lang.String,org.eclipse.persistence.internal.sessions.AbstractSession> sessionsByName
-
sequencing
protected org.eclipse.persistence.internal.sequencing.Sequencing sequencing
-
shouldUseDescriptorAliases
protected boolean shouldUseDescriptorAliases
-
-
Constructor Detail
-
SessionBroker
public SessionBroker()
PUBLIC: Create and return a session broker. Because a session broker has multiple sessions it does not used a login.
-
SessionBroker
protected SessionBroker(java.util.Map sessionNames)
INTERNAL: Create and return a session broker. Used internally to set the Names by Class from the parent. Reduces garbage.
-
-
Method Detail
-
acquireClientSessionBroker
public SessionBroker acquireClientSessionBroker()
PUBLIC: Return a session broker that behaves as a client session broker. An acquire session broker is done under the covers on each session inside the session broker, and a new broker is returned. NOTE: when finished with the client broker, it should be released.
-
acquireClientSessionBroker
public SessionBroker acquireClientSessionBroker(java.util.Map<java.lang.String,ConnectionPolicy> connectionPolicies, java.util.Map mapOfProperties)
PUBLIC: Return a session broker that behaves as a client session broker. An acquire session broker is done under the covers on each session inside the session broker, and a new broker is returned. NOTE: when finished with the client broker, it should be released.- Parameters:
connectionPolicies- maps session name to connectionPolicy to be used for this session;mapOfProperties- maps session name to properties to be used for this session.
-
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 classorg.eclipse.persistence.internal.sessions.AbstractSession- 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
-
releaseJTSConnection
public void releaseJTSConnection()
INTERNAL: Called in the end of beforeCompletion of external transaction sychronization listener. Close the managed sql connection corresponding to the external transaction, if applicable releases accessor.- Overrides:
releaseJTSConnectionin classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl
-
acquireUnitOfWork
public org.eclipse.persistence.internal.sessions.UnitOfWorkImpl acquireUnitOfWork()
PUBLIC: Return a unit of work for this session broker. Acquire a client session broker if is a server session broker.- Specified by:
acquireUnitOfWorkin interfaceSession- Overrides:
acquireUnitOfWorkin classorg.eclipse.persistence.internal.sessions.AbstractSession- See Also:
UnitOfWorkImpl
-
addDescriptor
public void addDescriptor(ClassDescriptor descriptor)
PUBLIC: You cannot add a descriptor to a session broker, you must add it to its session.- Specified by:
addDescriptorin interfaceDatabaseSession- Overrides:
addDescriptorin classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl- See Also:
DatabaseSession.addDescriptors(Collection),DatabaseSession.addDescriptors(Project)
-
addDescriptors
public void addDescriptors(java.util.Vector descriptors) throws ValidationExceptionPUBLIC: You cannot add descriptors to a session broker, you must add them to its session.- Throws:
ValidationException
-
addDescriptors
public void addDescriptors(Project project) throws ValidationException
PUBLIC: You cannot add a project to a session broker, you must add it to its session.- Specified by:
addDescriptorsin interfaceDatabaseSession- Overrides:
addDescriptorsin classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl- Throws:
ValidationException
-
addSequence
public void addSequence(Sequence sequence)
PUBLIC: You cannot add a sequence to a session broker, you must add it to its session.- Specified by:
addSequencein interfaceDatabaseSession- Overrides:
addSequencein classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl- See Also:
DatabaseSession.addDescriptor(org.eclipse.persistence.descriptors.ClassDescriptor),DatabaseSession.addDescriptors(java.util.Collection)
-
basicBeginTransaction
protected void basicBeginTransaction() throws DatabaseExceptionINTERNAL: Begin the transaction on all child sessions.- Overrides:
basicBeginTransactionin classorg.eclipse.persistence.internal.sessions.AbstractSession- Throws:
DatabaseException
-
basicCommitTransaction
protected void basicCommitTransaction() throws DatabaseExceptionINTERNAL: Commit the transaction on all child sessions. This assumes that the commit of the transaction will not fail because all of the modification has already taken place and no errors would have occurred.- Overrides:
basicCommitTransactionin classorg.eclipse.persistence.internal.sessions.AbstractSession- Throws:
DatabaseException
-
basicRollbackTransaction
protected void basicRollbackTransaction() throws DatabaseExceptionINTERNAL: Rollback the transaction on all child sessions.- Overrides:
basicRollbackTransactionin classorg.eclipse.persistence.internal.sessions.AbstractSession- Throws:
DatabaseException
-
containsQuery
public boolean containsQuery(java.lang.String queryName)
PUBLIC: Return true if the pre-defined query is defined on the session.- Specified by:
containsQueryin interfaceSession- Overrides:
containsQueryin classorg.eclipse.persistence.internal.sessions.AbstractSession
-
copySessionBroker
protected SessionBroker copySessionBroker()
INTERNAL: Return a copy (not using clone) of a session broker.
-
getAccessors
public java.util.Collection<org.eclipse.persistence.internal.databaseaccess.Accessor> getAccessors(Call call, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, DatabaseQuery query)
INTERNAL: Return the low-level database accessors. The database accessor is used for direct database access. The right accessor for this broker will be returned.- Overrides:
getAccessorsin classorg.eclipse.persistence.internal.sessions.AbstractSession
-
getAsOfClause
public AsOfClause getAsOfClause()
ADVANCED: Answers the past time this session is as of. Only meaningful for special historical sessions.- Specified by:
getAsOfClausein interfaceSession- Overrides:
getAsOfClausein classorg.eclipse.persistence.internal.sessions.AbstractSession- Returns:
- An immutable object representation of the past time.
nullif no clause set, or this a regular session. - See Also:
AsOfClause,acquireHistoricalSession(AsOfClause),Expression.hasAsOfClause()
-
getParent
public SessionBroker getParent()
INTERNAL: Gets the parent SessionBroker.- Overrides:
getParentin classorg.eclipse.persistence.internal.sessions.AbstractSession
-
getExecutionSession
public org.eclipse.persistence.internal.sessions.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 classorg.eclipse.persistence.internal.sessions.AbstractSession- Parameters:
query- may store session name or reference class for brokers case- Returns:
- a session with a live accessor
-
getPlatform
public org.eclipse.persistence.internal.databaseaccess.Platform getPlatform(java.lang.Class domainClass)
INTERNAL: Return the platform for a particular class.- Overrides:
getPlatformin classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl
-
getQuery
public DatabaseQuery getQuery(java.lang.String name, java.util.Vector arguments, boolean shouldSearchParent)
PUBLIC: Return the query from the session pre-defined queries with the given name and argument types. This allows for common queries to be pre-defined, reused and executed by name. This method should be used if the Session has multiple queries with the same name but different arguments. The search order is: for ClientSessionBroker: the broker; it's member ClientSessions (but not their parent ServerSessions); the parent SessionBroker. for ServerSession or DatabaseSession SessionBroker: the broker; it's member ServerSessions (or DatabaseSessions).- Overrides:
getQueryin classorg.eclipse.persistence.internal.sessions.AbstractSession
-
getSessionForClass
public org.eclipse.persistence.internal.sessions.AbstractSession getSessionForClass(java.lang.Class domainClass) throws ValidationExceptionINTERNAL: Return the session to be used for the class.- Overrides:
getSessionForClassin classorg.eclipse.persistence.internal.sessions.AbstractSession- Throws:
ValidationException
-
getSessionForName
public org.eclipse.persistence.internal.sessions.AbstractSession getSessionForName(java.lang.String name) throws ValidationExceptionINTERNAL: Return the session by name.- Overrides:
getSessionForNamein classorg.eclipse.persistence.internal.sessions.AbstractSession- Throws:
ValidationException
-
getSessionForQuery
protected org.eclipse.persistence.internal.sessions.AbstractSession getSessionForQuery(DatabaseQuery query)
INTERNAL: Answers the session to be used for the given query.
-
getSessionNamesByClass
protected java.util.Map<java.lang.Class,java.lang.String> getSessionNamesByClass()
INTERNAL: Return sessions indexed by class, each class can only have one default session.
-
getSessionsByName
public java.util.Map<java.lang.String,org.eclipse.persistence.internal.sessions.AbstractSession> getSessionsByName()
INTERNAL: Return sessions indexed by name.
-
initializeDescriptors
public void initializeDescriptors()
INTERNAL: Allow each descriptor to initialize any dependencies on this session. This is done in two passes to allow the inheritance to be resolved first. Normally the descriptors are added before login, then initialized on login. Should not be called on client SessoionBroker- Overrides:
initializeDescriptorsin classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl
-
initializeIdentityMapAccessor
public void initializeIdentityMapAccessor()
INTERNAL: Set up the IdentityMapManager. This method allows subclasses of Session to override the default IdentityMapManager functionality.- Overrides:
initializeIdentityMapAccessorin classorg.eclipse.persistence.internal.sessions.AbstractSession
-
internalExecuteQuery
public java.lang.Object internalExecuteQuery(DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractRecord row) throws DatabaseException, QueryException
INTERNAL: Return the results from exeucting the database query. the arguments should be a database row with raw data values. Find the correct child session to broker the query to, and return the result of the session executing the query.- Overrides:
internalExecuteQueryin classorg.eclipse.persistence.internal.sessions.AbstractSession- Throws:
DatabaseExceptionQueryException
-
isBroker
public boolean isBroker()
INTERNAL: Returns true if the session is a session Broker.- Overrides:
isBrokerin classorg.eclipse.persistence.internal.sessions.AbstractSession
-
isClientSessionBroker
public boolean isClientSessionBroker()
PUBLIC: Return if this session is a client session broker.
-
isConnected
public boolean isConnected()
PUBLIC: Return if all sessions are still connected to the database.- Specified by:
isConnectedin interfaceSession- Overrides:
isConnectedin classorg.eclipse.persistence.internal.sessions.AbstractSession
-
isServerSessionBroker
public boolean isServerSessionBroker()
PUBLIC: Return if this session is a server session broker.
-
isSessionBroker
public boolean isSessionBroker()
INTERNAL: Return if this session is a session broker.- Specified by:
isSessionBrokerin interfaceSession- Overrides:
isSessionBrokerin classorg.eclipse.persistence.internal.sessions.AbstractSession
-
login
public void login() throws DatabaseExceptionPUBLIC: Connect to the database using the predefined login. This connects all of the child sessions and expects that they are in a valid state to be connected.- Specified by:
loginin interfaceDatabaseSession- Overrides:
loginin classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl- Throws:
DatabaseException- See Also:
DatabaseSession.login(Login)
-
loginAndDetectDatasource
public void loginAndDetectDatasource() throws DatabaseExceptionPUBLIC: Connect to the database using the predefined login. During connection, attempt to auto detect the required database platform. This method can be used in systems where for ease of use developers have EclipseLink autodetect the platform. To be safe, however, the platform should be configured directly. The login must have been assigned when or after creating the session.- Overrides:
loginAndDetectDatasourcein classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl- Throws:
DatabaseException
-
login
public void login(java.lang.String userName, java.lang.String password) throws DatabaseExceptionPUBLIC: Connect to the database using the predefined login. This connects all of the child sessions and expects that they are in a valid state to be connected.- Specified by:
loginin interfaceDatabaseSession- Overrides:
loginin classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl- Throws:
DatabaseException
-
logout
public void logout() throws DatabaseExceptionPUBLIC: Disconnect from all databases.- Specified by:
logoutin interfaceDatabaseSession- Overrides:
logoutin classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl- Throws:
EclipseLinkException- if a transaction is active, you must rollback any active transaction before logout.DatabaseException- the database will also raise an error if their is an active transaction, or a general error occurs.
-
postLogin
public void postLogin()
INTERNAL: Rise postLogin events for member sessions and the SessionBroker.- Overrides:
postLoginin classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl
-
registerSession
public void registerSession(java.lang.String name, org.eclipse.persistence.internal.sessions.AbstractSession session)PUBLIC: Register the session under its name. All of the session's descriptors must have already been registered. DatabaseSession/ServerSession should not be connected and descriptors should not be initialized.
-
registerSession
public void registerSession(java.lang.String name, Session session)PUBLIC: Register the session under its name. All of the session's descriptors must have already been registered. DatabaseSession/ServerSession should not be connected and descriptors should not be initialized.
-
release
public void release()
PUBLIC: Release the session. This does nothing by default, but allows for other sessions such as the ClientSession to do something.
-
retryQuery
public java.lang.Object retryQuery(DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractRecord row, DatabaseException databaseException, int retryCount, org.eclipse.persistence.internal.sessions.AbstractSession executionSession)
INTERNAL: A query execution failed due to an invalid query. Re-connect and retry the query.- Overrides:
retryQueryin classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl
-
setExternalTransactionController
public void setExternalTransactionController(ExternalTransactionController externalTransactionController)
INTERNAL: Used for JTS integration internally by ServerPlatform.- Specified by:
setExternalTransactionControllerin interfaceDatabaseSession- Specified by:
setExternalTransactionControllerin interfaceSession- Overrides:
setExternalTransactionControllerin classorg.eclipse.persistence.internal.sessions.AbstractSession- See Also:
CustomServerPlatform
-
setIntegrityChecker
public void setIntegrityChecker(IntegrityChecker integrityChecker)
PUBLIC: set the integrityChecker. IntegrityChecker holds all the ClassDescriptor Exceptions.- Specified by:
setIntegrityCheckerin interfaceSession- Overrides:
setIntegrityCheckerin classorg.eclipse.persistence.internal.sessions.AbstractSession
-
setSessionLog
public void setSessionLog(SessionLog log)
PUBLIC: Set the session log.- Specified by:
setSessionLogin interfaceSession- Overrides:
setSessionLogin classorg.eclipse.persistence.internal.sessions.AbstractSession- See Also:
AbstractSession.logMessage(java.lang.String)
-
setLog
public void setLog(java.io.Writer log)
PUBLIC: Set the message log.
-
setProfiler
public void setProfiler(SessionProfiler profiler)
PUBLIC: Set the profiler for the session. This allows for performance operations to be profiled.- Specified by:
setProfilerin interfaceSession- Overrides:
setProfilerin classorg.eclipse.persistence.internal.sessions.AbstractSession
-
setSessionNameByClass
protected void setSessionNameByClass(java.util.HashMap sessionNameByClass)
INTERNAL: Set sessions indexed by class, each class can only have one default session.
-
setSessionsByName
public void setSessionsByName(java.util.Map sessionsByName)
INTERNAL: Set sessions indexed by name.
-
setSynchronized
public void setSynchronized(boolean synched)
INTERNAL: Set isSynchronized flag to indicate that members of session broker are synchronized. This method should only be called by setSynchronized method of UnitOfWork obtained from either DatabaseSession Broker or ClientSession Broker.- Overrides:
setSynchronizedin classorg.eclipse.persistence.internal.sessions.AbstractSession
-
writesCompleted
public void writesCompleted()
INTERNAL: This method notifies the accessor that a particular sets of writes has completed. This notification can be used for such thing as flushing the batch mechanism- Overrides:
writesCompletedin classorg.eclipse.persistence.internal.sessions.AbstractSession
-
initializeSequencing
public void initializeSequencing()
ADVANCED: Creates sequencing object for the session broker. Typically there is no need for the user to call this method - it is called by login() and acquireClientSessionBroker.- Overrides:
initializeSequencingin classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl
-
getSequencingHome
protected org.eclipse.persistence.internal.sequencing.SequencingHome getSequencingHome()
PROTECTED: Session broker doesn't have SequencingHome.- Overrides:
getSequencingHomein classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl
-
getSequencing
public org.eclipse.persistence.internal.sequencing.Sequencing getSequencing()
PUBLIC: Return the Sequencing object used by the session.- Overrides:
getSequencingin classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl
-
howManySequencingCallbacks
public int howManySequencingCallbacks()
INTERNAL: Returns a number of member sessions that require sequencing callback. Always returns 0 if sequencing is not connected.
-
isSequencingCallbackRequired
public boolean isSequencingCallbackRequired()
INTERNAL: Indicates whether SequencingCallback is required. Always returns false if sequencing is not connected.- Overrides:
isSequencingCallbackRequiredin classorg.eclipse.persistence.internal.sessions.DatabaseSessionImpl
-
shouldUseDescriptorAliases
public boolean shouldUseDescriptorAliases()
PUBLIC: Indicates whether descriptors should use aliasDescriptors map. If aliasDescriptors is used then descriptors' aliases should be unique.
-
setShouldUseDescriptorAliases
public void setShouldUseDescriptorAliases(boolean shouldUseDescriptorAliases)
PUBLIC: Indicates whether descriptors should use aliasDescriptors map. If aliasDescriptors is used then descriptors' aliases should be unique.
-
-