Top Description Fields Constructors Methods
org.eclipse.persistence.internal.sessions

public Class DatabaseSessionImpl

extends AbstractSession
implements DatabaseSession
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.sessions.DatabaseSession, org.eclipse.persistence.sessions.Session, org.eclipse.persistence.core.sessions.CoreSession
Known Direct Subclasses
org.eclipse.persistence.sessions.broker.SessionBroker, org.eclipse.persistence.sessions.remote.DistributedSession, org.eclipse.persistence.sessions.server.ServerSession
Imports
java.sql.Connection, .DatabaseMetaData, .SQLException, java.util.ArrayList, .Collection, .Date, .Enumeration, .HashMap, .Iterator, .List, .Map, .Vector, org.eclipse.persistence.config.PersistenceUnitProperties, .PropertiesUtils, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy, org.eclipse.persistence.exceptions.DatabaseException, .EclipseLinkException, .IntegrityException, .OptimisticLockException, .ValidationException, org.eclipse.persistence.internal.databaseaccess.Platform, org.eclipse.persistence.internal.helper.DBPlatformHelper, org.eclipse.persistence.internal.sequencing.Sequencing, .SequencingFactory, .SequencingHome, org.eclipse.persistence.logging.SessionLog, org.eclipse.persistence.platform.database.DatabasePlatform, .OraclePlatform, org.eclipse.persistence.platform.database.events.DatabaseEventListener, org.eclipse.persistence.platform.server.NoServerPlatform, .ServerPlatform, .ServerPlatformBase, org.eclipse.persistence.queries.AttributeGroup, .DatabaseQuery, .ObjectLevelReadQuery, .QueryResultsCachePolicy, .ReadQuery, org.eclipse.persistence.sequencing.Sequence, .SequencingControl, org.eclipse.persistence.sessions.DatasourceLogin, .Login, .SessionProfiler, org.eclipse.persistence.tools.tuning.SessionTuner

Implementation of org.eclipse.persistence.sessions.DatabaseSession The public interface should be used.
See Also
<p> <b>Purpose</b>: Define the implementation for a single user/single connection EclipseLink session. <p> <b>Description</b>: The session is the primary interface into EclipseLink, the application should do all of its reading and writing of objects through the session. The session also manages transactions and units of work. The database session is intended for usage in two-tier client-server applications. Although it could be used in a server situation, it is limited to only having a single database connection and only allows a single open database transaction. <p> <b>Responsibilities</b>: <ul> <li> Connecting/disconnecting. <li> Reading and writing objects. <li> Transaction and unit of work support. <li> Identity maps and caching. </ul>

Field Summary

Modifier and TypeField and Description
protected long
connectedTime

INTERNAL: connectedTime indicates the exact time this session was logged in.

protected DatabaseEventListener
databaseEventListener

Database event listener, this allows database events to invalidate the cache.

protected volatile boolean
isLoggedIn

INTERNAL Indicate if this session is logged in.

protected SequencingHome
sequencingHome

INTERNAL: sequencingHome for this session.

protected ServerPlatform
serverPlatform

Used to store the server platform that handles server-specific functionality for Oc4j, WLS, etc.

protected SessionTuner
tuner

Stores the tuner used to tune the configuration of this session.

Inherited from org.eclipse.persistence.internal.sessions.AbstractSession:
accessorsactiveCommandThreadsattributeGroupsbrokercommandManagercommitManagerdefaultReferenceModedeferredEventsdescriptorseventManagerexceptionHandlerexternalTransactionControlleridentityMapAccessorinjectionManagerintegrityCheckerisConcurrentisExecutingEventsisFinalizersEnabledisInBrokerisInProfileisLoggingOffisSynchronizedjpaQueriesProcessedlastDescriptorAccessedlogSessionStringmetadatalistenermultitenantContextPropertiesnamenumberOfActiveUnitsOfWorkobjectsLockedForClonepartitioningPolicypessimisticLockTimeoutDefaultpessimisticLockTimeoutUnitDefaultplatformprofilerprojectpropertiesqueriesqueryBuilderqueryTimeoutDefaultqueryTimeoutUnitDefaultserializersessionLogshouldCheckWriteLockshouldOptimizeResultSetAccessshouldPropagateChangesstaticMetamodelClassestablePerTenantDescriptorstablePerTenantQueriestolerateInvalidJPQLtransactionMutexwasJTSTransactionInternallyStarted

Constructor Summary

AccessConstructor and Description
public
DatabaseSessionImpl()

INTERNAL: Create and return a new default database session.

public
DatabaseSessionImpl(Login login)

PUBLIC: Create and return a new session.

public
DatabaseSessionImpl(Project project)

PUBLIC: Create and return a new session.

Method Summary

Modifier and TypeMethod and Description
public void
addDescriptor(ClassDescriptor descriptor)

Implements org.eclipse.persistence.sessions.DatabaseSession.addDescriptor.

PUBLIC: Add the descriptor to the session.
public void
addDescriptors(final Collection<E>
The descriptors to be added to the session and project.
descriptors
)

Implements org.eclipse.persistence.sessions.DatabaseSession.addDescriptors.

PUBLIC: Add the descriptors to the session.
public void
addDescriptors(Project project)

Implements org.eclipse.persistence.sessions.DatabaseSession.addDescriptors.

PUBLIC: Add the descriptors to the session from the Project.
public void
addDescriptorsToSequencing(Collection<ClassDescriptor>
class descriptors
descriptors
)

INTERNAL: If sequencing is connected then initializes sequences referenced by the passed descriptors, otherwise connects sequencing.

public void
addSequence(Sequence sequence)

Implements org.eclipse.persistence.sessions.DatabaseSession.addSequence.

PUBLIC: Add the sequence to the session.
public void
connect()

INTERNAL: Connect the session only.

public void
disconnect()

INTERNAL: Disconnect the accessor only.

protected void
finalize()

Overrides java.lang.Object.finalize.

INTERNAL: Logout in case still connected.
public long
getConnectedTime()

PUBLIC: Answer the time that this session got connected.

public DatabaseEventListener
getDatabaseEventListener()

Implements org.eclipse.persistence.sessions.DatabaseSession.getDatabaseEventListener.

Return the database event listener, this allows database events to invalidate the cache.
public Platform
public DatabasePlatform
getPlatform()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.getPlatform.

Implements org.eclipse.persistence.sessions.Session.getPlatform.

INTERNAL: Return the database platform currently connected to.
public Platform
getPlatform(Class<?> domainClass)

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.getPlatform.

INTERNAL: Return the database platform currently connected to for specified class.
protected Login
getReadLogin()

INTERNAL: Return the login for the read connection.

public Sequencing
getSequencing()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.getSequencing.

PUBLIC: Return the Sequencing object used by the session.
public SequencingControl
getSequencingControl()

Implements org.eclipse.persistence.sessions.DatabaseSession.getSequencingControl.

PUBLIC: Return SequencingControl which used for sequencing setup and customization including management of sequencing preallocation.
protected SequencingHome
getSequencingHome()

INTERNAL: Return SequencingHome which used to obtain all sequence-related interfaces for DatabaseSession

public ServerPlatform
getServerPlatform()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.getServerPlatform.

Implements org.eclipse.persistence.sessions.DatabaseSession.getServerPlatform, org.eclipse.persistence.sessions.Session.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.
public SessionTuner
getTuner()

Return the tuner used to tune the configuration of this session.

public void
initializeConnectedTime()

PUBLIC: Initialize the time that this session got connected.

public void
initializeDescriptorIfSessionAlive(ClassDescriptor descriptor)

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.

public void
initializeDescriptors()

INTERNAL: Allow each descriptor to initialize any dependencies on this session.

public void
initializeDescriptors(Map<K, V> descriptors)

INTERNAL: Allow each descriptor to initialize any dependencies on this session.

public void
public void
initializeDescriptors(Map<K, V> descriptors, boolean shouldInitializeSequencing)

INTERNAL: Allow each descriptor to initialize any dependencies on this session.

public void
initializeDescriptors(Collection<E> descriptors, boolean shouldInitializeSequencing)

public void
initializeSequencing()

INTERNAL: Creates sequencing object

public boolean
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.

public boolean
isProtectedSession()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.isProtectedSession.

PUBLIC: Returns true if Protected Entities should be built within this session
public boolean
isSequencingCallbackRequired()

INTERNAL: Indicates whether SequencingCallback is required.

public void
login()

Implements org.eclipse.persistence.sessions.DatabaseSession.login.

PUBLIC: Connect to the database using the predefined login.
public void
login(String userName, String password)

Implements org.eclipse.persistence.sessions.DatabaseSession.login.

PUBLIC: Connect to the database using the given user name and password.
public void
login(Login login)

Implements org.eclipse.persistence.sessions.DatabaseSession.login.

PUBLIC: Connect to the database using the given login.
public void
loginAndDetectDatasource()

PUBLIC: Connect to the database using the predefined login.

public void
logout()

Implements org.eclipse.persistence.sessions.DatabaseSession.logout.

PUBLIC: Disconnect from the database.
protected void
postConnectDatasource()

INTERNAL: This method includes all of the code that is issued after the datasource is connected to.

public void
postLogin()

INTERNAL: Rise postLogin event.

protected void
preConnectDatasource()

INTERNAL: This method includes all of the code that is issued before the datasource is connected to.

public void
releaseJTSConnection()

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.releaseJTSConnection.

INTERNAL: Called in the end of beforeCompletion of external transaction synchronization listener.
public Object
retryQuery(DatabaseQuery query, AbstractRecord row, DatabaseException databaseException, int retryCount, AbstractSession executionSession)

Overrides org.eclipse.persistence.internal.sessions.AbstractSession.retryQuery.

INTERNAL: A query execution failed due to an invalid query.
public void
setDatabaseEventListener(DatabaseEventListener databaseEventListener)

Implements org.eclipse.persistence.sessions.DatabaseSession.setDatabaseEventListener.

PUBLIC: Set the database event listener, this allows database events to invalidate the cache.
public void
setDatasourceAndInitialize()

INTERNAL: Issue any pre connect and post connect without an actual connection to the database.

protected void
setOrDetectDatasource(boolean
- set to true if the caller cares to throw exceptions, false to swallow them.
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.

public void
setServerPlatform(ServerPlatform newServerPlatform)

Implements org.eclipse.persistence.sessions.DatabaseSession.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.
public void
setTuner(SessionTuner tuner)

Set the tuner used to tune the configuration of this session.

public void
writeAllObjects(Collection<E> domainObjects)

Implements org.eclipse.persistence.sessions.DatabaseSession.writeAllObjects.

PUBLIC: Write all of the objects and all of their privately owned parts in the database.
public void
writeAllObjects(Vector<E> domainObjects)

PUBLIC: Write all of the objects and all of their privately owned parts in the database.

Inherited from org.eclipse.persistence.internal.sessions.AbstractSession:
acquireHistoricalSessionacquireNonSynchronizedUnitOfWorkacquireNonSynchronizedUnitOfWorkacquireRepeatableWriteUnitOfWorkacquireUnitOfWorkacquireUnitOfWorkaddAliasaddJPAQueryaddJPATablePerTenantQueryaddMultitenantContextPropertyaddQueryaddQueryaddQueryaddStaticMetamodelClassaddTablePerTenantDescriptoraddTablePerTenantQuerybasicBeginTransactionbasicBeginTransactionbasicCommitTransactionbasicExecuteCallbasicRollbackTransactionbeginExternalTransactionbeginTransactionbuildDefaultQueryBuildercheckAndRefreshInvalidObjectcheckHierarchyForDescriptorcleanUpInjectionManagerclearDescriptorsclearIntegrityCheckerclearLastDescriptorAccessedclearProfileclonecommitExternalTransactioncommitTransactioncompareObjectscompareObjectsDontMatchconfigcontainsQuerycopycopycopyDescriptorNamedQueriescopyDescriptorsFromProjectcopyInternalcopyReadOnlyClassescreateCloneQueryValueHoldercreateCloneTransformationValueHoldercreateInjectionManagercreateProtectedInstanceFromCachedDatadeferEventdeleteAllObjectsdeleteObjectdoesObjectExistdontLogMessagesendOperationProfileendOperationProfileexecuteCallexecuteDeferredEventsexecuteNonSelectingCallexecuteNonSelectingSQLexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteQueryexecuteSelectingCallexecuteSQLfinefinerfinestgetAccessorgetAccessorsgetAccessorsgetActiveCommandThreadsgetActiveSessiongetActiveUnitOfWorkgetAliasDescriptorsgetAllQueriesgetAsOfClausegetAttributeGroupsgetBrokergetCacheKeyFromTargetSessionForMergegetClassDescriptorgetClassDescriptorgetClassDescriptorForAliasgetCommandManagergetCommitManagergetDatasourceLogingetDefaultReadOnlyClassesgetDefaultReferenceModegetDescriptorgetDescriptorgetDescriptorForAliasgetDescriptorsgetEventManagergetExceptionHandlergetExceptionHandlerClassgetExecutionSessiongetExternalTransactionControllergetIdgetIdentityMapAccessorgetIdentityMapAccessorInstancegetInjectionManagergetIntegrityCheckergetJPAQueriesgetJPATablePerTenantQueriesgetLoadergetLoggetLogingetLogLevelgetLogLevelgetLogSessionStringgetMappedSuperclassgetMultitenantContextPropertiesgetNamegetNextQueryIdgetNextSequenceNumberValuegetNumberOfActiveUnitsOfWorkgetParentgetParentIdentityMapSessiongetParentIdentityMapSessiongetParentIdentityMapSessiongetPartitioningPolicygetPessimisticLockTimeoutDefaultgetPessimisticLockTimeoutUnitDefaultgetProfilergetProjectgetPropertiesgetPropertygetQueriesgetQuerygetQuerygetQuerygetQuerygetQueryBuildergetQueryTimeoutDefaultgetQueryTimeoutUnitDefaultgetRefreshMetadataListenergetRootSessiongetSerializergetSessionForClassgetSessionForNamegetSessionLoggetSessionTypeStringgetStaticMetamodelClassgetTablePerTenantDescriptorsgetTablePerTenantQueriesgetTransactionMutexhandleExceptionhandleSeverehasBrokerhasCommitManagerhasDescriptorhasEventManagerhasExceptionHandlerhasExternalTransactionControllerhasPropertieshasTablePerTenantDescriptorshasTablePerTenantQueriesincrementProfileincrementProfileinfoinitializeIdentityMapAccessorinsertObjectinternalExecuteQueryisBrokerisClassReadOnlyisClassReadOnlyisClientSessionisConcurrentisConnectedisConsideredInvalidisDistributedSessionisExclusiveConnectionRequiredisExclusiveIsolatedClientSessionisFinalizersEnabledisHistoricalSessionisInBrokerisInProfileisInTransactionisIsolatedClientSessionisJPAQueriesProcessedisLoggingOffisRemoteSessionisRemoteUnitOfWorkisServerSessionisSessionBrokerisSynchronizedisUnitOfWorkkeyFromObjectloadloadlogloglogloglogloglogloglogMessagelogMessagelogThrowablepostAcquireConnectionprepareDatabaseQuerypreReleaseConnectionpriviledgedExecuteNonSelectingCallpriviledgedExecuteSelectingCallprocessCommandprocessJPAQueriesprocessJPAQueryreadAllObjectsreadAllObjectsreadAllObjectsreadAllObjectsreadObjectreadObjectreadObjectreadObjectreadObjectrefreshAndLockObjectrefreshAndLockObjectrefreshObjectregisterFinalizerreleasereleaseConnectionAfterCallreleaseReadConnectionreleaseUnitOfWorkremovePropertyremoveQueryremoveQueryretrieveCacheKeyretryTransactionrollbackExternalTransactionrollbackTransactionsetAccessorsetBrokersetCommandManagersetCommitManagersetDatasourceLoginsetDefaultReferenceModesetEventManagersetExceptionHandlersetExternalTransactionControllersetInjectionManagersetIntegrityCheckersetIsConcurrentsetIsFinalizersEnabledsetIsInBrokersetIsInProfilesetJPAQueriesProcessedsetLogsetLoggingOffsetLoginsetLoginsetLogLevelsetNamesetNumberOfActiveUnitsOfWorksetPartitioningPolicysetPessimisticLockTimeoutDefaultsetPessimisticLockTimeoutUnitDefaultsetProfilersetProjectsetPropertiessetPropertysetQueriessetQueryBuildersetQueryTimeoutDefaultsetQueryTimeoutUnitDefaultsetRefreshMetadataListenersetSerializersetSessionLogsetShouldOptimizeResultSetAccesssetShouldPropagateChangessetSynchronizedsetTolerateInvalidJPQLsetTransactionMutexsetWasJTSTransactionInternallyStartedsevereshouldDisplayDatashouldLogshouldLogMessagesshouldLogMessagesshouldOptimizeResultSetAccessshouldPropagateChangesshouldTolerateInvalidJPQLstartOperationProfilestartOperationProfiletoStringunwrapObjectupdateObjectupdateProfileupdateTablePerTenantDescriptorsvalidateCachevalidateQueryverifyDeletewarningwasJTSTransactionInternallyStartedwrapObjectwriteAllObjectsWithChangeSetwriteObjectwritesCompleted