Module org.eclipse.persistence.core
Class DatabaseSessionImpl
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.sessions.DatabaseSessionImpl
- All Implemented Interfaces:
Serializable
,Cloneable
,CoreSession<ClassDescriptor,
,Login, Platform, Project, SessionEventManager> CommandProcessor
,DatabaseSession
,Session
- Direct Known Subclasses:
DistributedSession
,ServerSession
,SessionBroker
Implementation of org.eclipse.persistence.sessions.DatabaseSession
The public interface should be used.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected long
INTERNAL: connectedTime indicates the exact time this session was logged in.protected DatabaseEventListener
Database event listener, this allows database events to invalidate the cache.protected boolean
INTERNAL Indicate if this session is logged in.protected SequencingHome
INTERNAL: sequencingHome for this session.protected ServerPlatform
Used to store the server platform that handles server-specific functionality for Oc4j, WLS, etc.protected SessionTuner
Stores the tuner used to tune the configuration of this session.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
ConstructorDescriptionINTERNAL: Create and return a new default database session.DatabaseSessionImpl
(Login login) PUBLIC: Create and return a new session.DatabaseSessionImpl
(Project project) PUBLIC: Create and return a new session. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDescriptor
(ClassDescriptor descriptor) PUBLIC: Add the descriptor to the session.void
addDescriptors
(Collection descriptors) PUBLIC: Add the descriptors to the session.void
addDescriptors
(Project project) PUBLIC: Add the descriptors to the session from the Project.void
addDescriptorsToSequencing
(Collection<ClassDescriptor> descriptors) INTERNAL: If sequencing is connected then initializes sequences referenced by the passed descriptors, otherwise connects sequencing.void
addSequence
(Sequence sequence) PUBLIC: Add the sequence to the session.void
connect()
INTERNAL: Connect the session only.void
INTERNAL: Disconnect the accessor only.protected void
finalize()
INTERNAL: Logout in case still connected.long
PUBLIC: Answer the time that this session got connected.Return the database event listener, this allows database events to invalidate the cache.INTERNAL: Return the database platform currently connected to.INTERNAL: Return the database platform currently connected to.getPlatform
(Class<?> domainClass) INTERNAL: Return the database platform currently connected to for specified class.protected Login
INTERNAL: Return the login for the read connection.PUBLIC: Return the Sequencing object used by the session.PUBLIC: Return SequencingControl which used for sequencing setup and customization including management of sequencing preallocation.protected SequencingHome
INTERNAL: Return SequencingHome which used to obtain all sequence-related interfaces for DatabaseSessionPUBLIC: Answer the server platform to handle server specific behavior for WLS, Oc4j, etc.getTuner()
Return the tuner used to tune the configuration of this session.void
PUBLIC: Initialize the time that this session got connected.void
initializeDescriptorIfSessionAlive
(ClassDescriptor descriptor) INTERNAL: A descriptor may have been added after the session is logged in.void
INTERNAL: Allow each descriptor to initialize any dependencies on this session.void
initializeDescriptors
(Collection descriptors) void
initializeDescriptors
(Collection descriptors, boolean shouldInitializeSequencing) void
initializeDescriptors
(Map descriptors) INTERNAL: Allow each descriptor to initialize any dependencies on this session.void
initializeDescriptors
(Map descriptors, boolean shouldInitializeSequencing) INTERNAL: Allow each descriptor to initialize any dependencies on this session.void
INTERNAL: Creates sequencing objectboolean
INTERNAL: Return if this session is a database session.boolean
INTERNAL: Return if the session was logged in.boolean
PUBLIC: Returns true if Protected Entities should be built within this sessionboolean
INTERNAL: Indicates whether SequencingCallback is required.void
login()
PUBLIC: Connect to the database using the predefined login.void
PUBLIC: Connect to the database using the given user name and password.void
PUBLIC: Connect to the database using the given login.void
PUBLIC: Connect to the database using the predefined login.void
logout()
PUBLIC: Disconnect from the database.protected void
INTERNAL: This method includes all of the code that is issued after the datasource is connected to.void
INTERNAL: Rise postLogin event.protected void
INTERNAL: This method includes all of the code that is issued before the datasource is connected to.void
INTERNAL: Called in the end of beforeCompletion of external transaction synchronization listener.retryQuery
(DatabaseQuery query, AbstractRecord row, DatabaseException databaseException, int retryCount, AbstractSession executionSession) INTERNAL: A query execution failed due to an invalid query.void
setDatabaseEventListener
(DatabaseEventListener databaseEventListener) PUBLIC: Set the database event listener, this allows database events to invalidate the cache.void
INTERNAL: Issue any pre connect and post connect without an actual connection to the database.protected void
setOrDetectDatasource
(boolean throwException) INTERNAL: Will set the platform from specified schema generation properties or by detecting it through the connection (if one is available).protected void
setSequencingHome
(SequencingHome sequencingHome) INTERNAL: Set the SequencingHome object used by the session.void
setServerPlatform
(ServerPlatform newServerPlatform) PUBLIC: Set the server platform to handle server specific behavior for WLS, Oc4j, etc This is not permitted after the session is logged in.void
setTuner
(SessionTuner tuner) Set the tuner used to tune the configuration of this session.void
writeAllObjects
(Collection domainObjects) PUBLIC: Write all of the objects and all of their privately owned parts in the database.void
writeAllObjects
(Vector domainObjects) PUBLIC: Write all of the objects and all of their privately owned parts in the database.Methods inherited from class org.eclipse.persistence.internal.sessions.AbstractSession
acquireHistoricalSession, acquireNonSynchronizedUnitOfWork, acquireNonSynchronizedUnitOfWork, acquireRepeatableWriteUnitOfWork, acquireUnitOfWork, acquireUnitOfWork, addAlias, addJPAQuery, addJPATablePerTenantQuery, addMultitenantContextProperty, addQuery, addQuery, addQuery, addStaticMetamodelClass, addTablePerTenantDescriptor, addTablePerTenantQuery, basicBeginTransaction, basicBeginTransaction, basicCommitTransaction, basicExecuteCall, basicRollbackTransaction, beginExternalTransaction, beginTransaction, buildDefaultQueryBuilder, checkAndRefreshInvalidObject, checkHierarchyForDescriptor, cleanUpInjectionManager, clearDescriptors, clearIntegrityChecker, clearLastDescriptorAccessed, clearProfile, clone, commitExternalTransaction, commitTransaction, 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, getAsOfClause, getAttributeGroups, getBroker, getCacheKeyFromTargetSessionForMerge, getClassDescriptor, getClassDescriptor, getClassDescriptorForAlias, getCommandManager, getCommitManager, getDatasourceLogin, getDefaultReadOnlyClasses, getDefaultReferenceMode, getDescriptor, getDescriptor, getDescriptorForAlias, getDescriptors, getEventManager, getExceptionHandler, getExceptionHandlerClass, getExecutionSession, getExternalTransactionController, getId, getIdentityMapAccessor, getIdentityMapAccessorInstance, getInjectionManager, getIntegrityChecker, getJPAQueries, getJPATablePerTenantQueries, getLoader, getLog, getLogin, getLogLevel, getLogLevel, getLogSessionString, getMappedSuperclass, getMultitenantContextProperties, getName, getNextQueryId, getNextSequenceNumberValue, getNumberOfActiveUnitsOfWork, getParent, getParentIdentityMapSession, getParentIdentityMapSession, getParentIdentityMapSession, getPartitioningPolicy, getPessimisticLockTimeoutDefault, getPessimisticLockTimeoutUnitDefault, getProfiler, getProject, getProperties, getProperty, getQueries, getQuery, getQuery, getQuery, getQuery, getQueryBuilder, getQueryTimeoutDefault, getQueryTimeoutUnitDefault, getRefreshMetadataListener, getRootSession, 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, internalExecuteQuery, isBroker, isClassReadOnly, isClassReadOnly, isClientSession, isConcurrent, isConnected, isConsideredInvalid, isDistributedSession, isExclusiveConnectionRequired, isExclusiveIsolatedClientSession, isFinalizersEnabled, isHistoricalSession, isInBroker, isInProfile, isInTransaction, isIsolatedClientSession, isJPAQueriesProcessed, isLoggingOff, isRemoteSession, isRemoteUnitOfWork, isServerSession, isSessionBroker, isSynchronized, isUnitOfWork, keyFromObject, load, load, 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, release, releaseConnectionAfterCall, releaseReadConnection, releaseUnitOfWork, removeProperty, removeQuery, removeQuery, retrieveCacheKey, retryTransaction, rollbackExternalTransaction, rollbackTransaction, 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, toString, unwrapObject, updateObject, updateProfile, updateTablePerTenantDescriptors, validateCache, validateQuery, verifyDelete, warning, wasJTSTransactionInternallyStarted, wrapObject, writeAllObjectsWithChangeSet, writeObject, writesCompleted
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, setExternalTransactionController, setLogin, setShouldPropagateChanges, shouldPropagateChanges, updateObject, writeObject
Methods inherited from interface org.eclipse.persistence.sessions.Session
acquireHistoricalSession, acquireUnitOfWork, acquireUnitOfWork, addJPAQuery, addQuery, clearIntegrityChecker, clearProfile, containsQuery, copy, copy, doesObjectExist, dontLogMessages, executeNonSelectingCall, executeNonSelectingSQL, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeQuery, executeSelectingCall, executeSQL, getActiveSession, getActiveUnitOfWork, getAsOfClause, 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, isConnected, isDistributedSession, isFinalizersEnabled, isInProfile, isRemoteSession, isRemoteUnitOfWork, isServerSession, isSessionBroker, isUnitOfWork, log, logMessage, readAllObjects, readAllObjects, readAllObjects, readObject, readObject, readObject, readObject, refreshObject, release, removeProperty, removeQuery, setDefaultReferenceMode, setExceptionHandler, setIntegrityChecker, setIsFinalizersEnabled, setLog, setLogLevel, setName, setPartitioningPolicy, setProfiler, setProperty, setQueryTimeoutDefault, setQueryTimeoutUnitDefault, setSerializer, setSessionLog, shouldLog, shouldLogMessages, validateCache
-
Field Details
-
databaseEventListener
Database event listener, this allows database events to invalidate the cache. -
sequencingHome
INTERNAL: sequencingHome for this session. -
serverPlatform
Used to store the server platform that handles server-specific functionality for Oc4j, WLS, etc. -
tuner
Stores the tuner used to tune the configuration of this session. -
connectedTime
protected long connectedTimeINTERNAL: connectedTime indicates the exact time this session was logged in. -
isLoggedIn
protected volatile boolean isLoggedInINTERNAL Indicate if this session is logged in.
-
-
Constructor Details
-
DatabaseSessionImpl
public DatabaseSessionImpl()INTERNAL: Create and return a new default database session. Used for EJB SessionManager to instantiate a database session -
DatabaseSessionImpl
PUBLIC: Create and return a new session. By giving the login information on creation this allows the session to initialize itself to the platform given in the login. This constructor does not return a connected session. To connect the session to the database login() must be sent to it. The login(userName, password) method may also be used to connect the session, this allows for the user name and password to be given at login but for the other database information to be provided when the session is created. -
DatabaseSessionImpl
PUBLIC: Create and return a new session. This constructor does not return a connected session. To connect the session to the database login() must be sent to it. The login(userName, password) method may also be used to connect the session, this allows for the user name and password to be given at login but for the other database information to be provided when the session is created.
-
-
Method Details
-
setSequencingHome
INTERNAL: Set the SequencingHome object used by the session. -
getSequencingHome
INTERNAL: Return SequencingHome which used to obtain all sequence-related interfaces for DatabaseSession -
isLoggedIn
public boolean isLoggedIn()INTERNAL: Return if the session was logged in. This may slight differ to isConnected which asks the JDBC Connection if it is connected. -
getDatabaseEventListener
Return the database event listener, this allows database events to invalidate the cache.- Specified by:
getDatabaseEventListener
in interfaceDatabaseSession
-
setDatabaseEventListener
PUBLIC: Set the database event listener, this allows database events to invalidate the cache.- Specified by:
setDatabaseEventListener
in interfaceDatabaseSession
-
setDatasourceAndInitialize
INTERNAL: Issue any pre connect and post connect without an actual connection to the database. Descriptors are initialized in postConnectDatasource and are used in DDL generation. This will look to set the schema platform via the JPA 2.1 properties or through a detection on the connection before DDL generation.- Throws:
DatabaseException
-
setOrDetectDatasource
protected void setOrDetectDatasource(boolean throwException) INTERNAL: Will set the platform from specified schema generation properties or by detecting it through the connection (if one is available). Any connection that is open for detection is closed before this method returns.- Parameters:
throwException
- - set to true if the caller cares to throw exceptions, false to swallow them.
-
getSequencingControl
PUBLIC: Return SequencingControl which used for sequencing setup and customization including management of sequencing preallocation.- Specified by:
getSequencingControl
in interfaceDatabaseSession
-
getSequencing
PUBLIC: Return the Sequencing object used by the session.- Overrides:
getSequencing
in classAbstractSession
-
isSequencingCallbackRequired
public boolean isSequencingCallbackRequired()INTERNAL: Indicates whether SequencingCallback is required. Always returns false if sequencing is not connected. -
initializeSequencing
public void initializeSequencing()INTERNAL: Creates sequencing object -
addDescriptorsToSequencing
INTERNAL: If sequencing is connected then initializes sequences referenced by the passed descriptors, otherwise connects sequencing.- Parameters:
descriptors
- class descriptors
-
releaseJTSConnection
public void releaseJTSConnection()INTERNAL: Called in the end of beforeCompletion of external transaction synchronization listener. Close the managed sql connection corresponding to the external transaction.- Overrides:
releaseJTSConnection
in classAbstractSession
-
addDescriptor
PUBLIC: Add the descriptor to the session. All persistent classes must have a descriptor registered for them with the session. It is best to add the descriptors before login, if added after login the order in which descriptors are added is dependent on inheritance and references unless the addDescriptors method is used.- Specified by:
addDescriptor
in interfaceDatabaseSession
- See Also:
-
addDescriptors
PUBLIC: Add the descriptors to the session. All persistent classes must have a descriptor registered for them with the session. This method allows for a batch of descriptors to be added at once so that EclipseLink can resolve the dependencies between the descriptors and perform initialization optimally.- Specified by:
addDescriptors
in interfaceDatabaseSession
- Parameters:
descriptors
- The descriptors to be added to the session and project.
-
addDescriptors
PUBLIC: Add the descriptors to the session from the Project. This can be used to combine the descriptors from multiple projects into a single session. This can be called after the session has been connected as long as there are no external dependencies.- Specified by:
addDescriptors
in interfaceDatabaseSession
-
addSequence
PUBLIC: Add the sequence to the session. Allows to add a new sequence to the session even if the session is connected. If the session is connected then the sequence is added only if there is no sequence with the same name already in use. Call this method before addDescriptor(s) if need to add new descriptor with a new non-default sequence to connected session.- Specified by:
addSequence
in interfaceDatabaseSession
- See Also:
-
connect
INTERNAL: Connect the session only.- Throws:
DatabaseException
-
disconnect
INTERNAL: Disconnect the accessor only.- Throws:
DatabaseException
-
getServerPlatform
PUBLIC: Answer the server platform to handle server specific behavior for WLS, Oc4j, etc. If the user wants a different external transaction controller class or to provide some different behavior than the provided ServerPlatform(s), we recommend subclassing org.eclipse.persistence.platform.server.ServerPlatformBase (or a subclass), and overriding: ServerPlatformBase.getExternalTransactionControllerClass() ServerPlatformBase.registerMBean() ServerPlatformBase.unregisterMBean() for the desired behavior.- Specified by:
getServerPlatform
in interfaceDatabaseSession
- Specified by:
getServerPlatform
in interfaceSession
- Overrides:
getServerPlatform
in classAbstractSession
- See Also:
-
setServerPlatform
PUBLIC: Set the server platform to handle server specific behavior for WLS, Oc4j, etc This is not permitted after the session is logged in. If the user wants a different external transaction controller class or to provide some different behavior than the provided ServerPlatform(s), we recommend subclassing org.eclipse.persistence.platform.server.ServerPlatformBase (or a subclass), and overriding: ServerPlatformBase.getExternalTransactionControllerClass() ServerPlatformBase.registerMBean() ServerPlatformBase.unregisterMBean() for the desired behavior.- Specified by:
setServerPlatform
in interfaceDatabaseSession
- See Also:
-
finalize
INTERNAL: Logout in case still connected.- Overrides:
finalize
in classObject
- Throws:
DatabaseException
-
getPlatform
INTERNAL: Return the database platform currently connected to. The platform is used for database specific behavior. NOTE: this must only be used for relational specific usage, it will fail for non-relational datasources.- Specified by:
getPlatform
in interfaceSession
- Overrides:
getPlatform
in classAbstractSession
-
getDatasourcePlatform
INTERNAL: Return the database platform currently connected to. The platform is used for database specific behavior.- Specified by:
getDatasourcePlatform
in interfaceCoreSession<ClassDescriptor,
Login, Platform, Project, SessionEventManager> - Specified by:
getDatasourcePlatform
in interfaceSession
- Overrides:
getDatasourcePlatform
in classAbstractSession
-
getPlatform
INTERNAL: Return the database platform currently connected to for specified class. The platform is used for database specific behavior.- Overrides:
getPlatform
in classAbstractSession
-
initializeDescriptorIfSessionAlive
INTERNAL: A descriptor may have been added after the session is logged in. In this case the descriptor must be allowed to initialize any dependencies on this session. Normally the descriptors are added before login, then initialized on login. -
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. -
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. The descriptors session must be used, not the broker. Sequencing is (re)initialized: disconnected (if has been already connected), then connected. -
initializeDescriptors
-
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. The descriptors session must be used, not the broker. If shouldInitializeSequencing parameter is true then sequencing is (re)initialized: disconnected (if has been connected), then connected. If shouldInitializeSequencing parameter is false then if sequencing has been already connected, then it stays connected: only the new sequences used by the passed descriptors are initialized; otherwise, if sequencing has NOT been connected then it is connected (just like in shouldInitializeSequencing==true case); disconnected (if has been connected), then connected. -
initializeDescriptors
-
isDatabaseSession
public boolean isDatabaseSession()INTERNAL: Return if this session is a database session.- Specified by:
isDatabaseSession
in interfaceSession
- Overrides:
isDatabaseSession
in classAbstractSession
-
isProtectedSession
public boolean isProtectedSession()PUBLIC: Returns true if Protected Entities should be built within this session- Overrides:
isProtectedSession
in classAbstractSession
-
getReadLogin
INTERNAL: Return the login for the read connection. Used by the platform autodetect feature -
loginAndDetectDatasource
PUBLIC: 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.- Throws:
DatabaseException
-
login
PUBLIC: Connect to the database using the predefined login. The login must have been assigned when or after creating the session.- Specified by:
login
in interfaceDatabaseSession
- Throws:
DatabaseException
- See Also:
-
preConnectDatasource
protected void preConnectDatasource()INTERNAL: This method includes all of the code that is issued before the datasource is connected to. -
postConnectDatasource
protected void postConnectDatasource()INTERNAL: This method includes all of the code that is issued after the datasource is connected to. -
postLogin
public void postLogin()INTERNAL: Rise postLogin event. -
login
PUBLIC: Connect to the database using the given user name and password. The additional login information must have been preset in the session's login attribute. This is the login that should be used if each user has their own id, but all users share the same database configuration.- Specified by:
login
in interfaceDatabaseSession
- Throws:
DatabaseException
-
login
PUBLIC: Connect to the database using the given login. The login may also the preset and the login() protocol called. This is the login should only be used if each user has their own database configuration.- Specified by:
login
in interfaceDatabaseSession
- Throws:
DatabaseException
-
logout
PUBLIC: Disconnect from the database.- Specified by:
logout
in interfaceDatabaseSession
- 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.
-
initializeConnectedTime
public void initializeConnectedTime()PUBLIC: Initialize the time that this session got connected. This can help determine how long a session has been connected. -
getConnectedTime
public long getConnectedTime()PUBLIC: Answer the time that this session got connected. This can help determine how long a session has been connected. -
writeAllObjects
public void writeAllObjects(Collection domainObjects) throws DatabaseException, OptimisticLockException PUBLIC: Write all of the objects and all of their privately owned parts in the database. The objects will be committed through a single transaction.- Specified by:
writeAllObjects
in interfaceDatabaseSession
- Throws:
DatabaseException
- if an error occurs on the database, these include constraint violations, security violations and general database errors.OptimisticLockException
- if the object's descriptor is using optimistic locking and the object has been updated or deleted by another user since it was last read.
-
writeAllObjects
PUBLIC: Write all of the objects and all of their privately owned parts in the database. The objects will be committed through a single transaction.- Throws:
DatabaseException
- if an error occurs on the database, these include constraint violations, security violations and general database errors.OptimisticLockException
- if the object's descriptor is using optimistic locking and the object has been updated or deleted by another user since it was last read.
-
retryQuery
public Object retryQuery(DatabaseQuery query, AbstractRecord row, DatabaseException databaseException, int retryCount, AbstractSession executionSession) INTERNAL: A query execution failed due to an invalid query. Re-connect and retry the query.- Overrides:
retryQuery
in classAbstractSession
-
getTuner
Return the tuner used to tune the configuration of this session. -
setTuner
Set the tuner used to tune the configuration of this session.
-