Top Description Methods
org.eclipse.persistence.sessions

public Interface Session

extends CoreSession<ClassDescriptor, Login, Platform, Project, SessionEventManager>
Known Direct Subinterfaces
org.eclipse.persistence.sessions.UnitOfWork, org.eclipse.persistence.sessions.DatabaseSession
Known Direct Implementers
org.eclipse.persistence.internal.sessions.AbstractSession
Imports
java.io.Writer, java.util.List, .Map, .Vector, java.util.concurrent.TimeUnit, org.eclipse.persistence.config.ReferenceMode, org.eclipse.persistence.core.sessions.CoreSession, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.descriptors.partitioning.PartitioningPolicy, org.eclipse.persistence.exceptions.DatabaseException, .EclipseLinkException, .ExceptionHandler, .IntegrityChecker, .ValidationException, org.eclipse.persistence.expressions.Expression, org.eclipse.persistence.internal.databaseaccess.Platform, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl, org.eclipse.persistence.logging.SessionLog, .SessionLogEntry, org.eclipse.persistence.platform.database.DatabasePlatform, org.eclipse.persistence.platform.server.ServerPlatform, org.eclipse.persistence.queries.AttributeGroup, .Call, .DatabaseQuery, .JPQLCall, .ReadAllQuery, .ReadObjectQuery, .SQLCall, org.eclipse.persistence.sessions.serializers.Serializer

Purpose: Define the EclipseLink session public interface.

Description: This interface is meant to clarify the public protocol into EclipseLink. It also allows for non-subclasses of Session to conform to the EclipseLink API. It should be used as the applications main interface into the EclipseLink API to ensure compatibility between all EclipseLink sessions.

Responsibilities:

See Also
UnitOfWork, DatabaseSession, org.eclipse.persistence.internal.sessions.AbstractSession, org.eclipse.persistence.internal.sessions.DatabaseSessionImpl, org.eclipse.persistence.sessions.server.ServerSession, org.eclipse.persistence.sessions.server.ClientSession

Method Summary

Modifier and TypeMethod and Description
public Session
acquireHistoricalSession(AsOfClause
Represents a valid snap shot time.
pastTime
)

ADVANCED: Returns a light weight read-only session where all objects are automatically read as of the specified past time.

public UnitOfWork
acquireUnitOfWork()

PUBLIC: Return a unit of work for this session.

public UnitOfWork
acquireUnitOfWork(ReferenceMode
The reference type the UOW should use internally when referencing Working clones. Setting this to WEAK means the UOW will use weak references to reference clones that support active object change tracking and hard references for deferred change tracked objects. Setting to FORCE_WEAK means that all objects will be referenced by weak references and if the application no longer references the clone the clone may be garbage collected. If the clone has uncommitted changes then those changes will be lost.
referenceMode
)

PUBLIC: Return a unit of work for this session.

public void
addJPAQuery(DatabaseQuery query)

ADVANCED: Add a pre-defined not yet parsed JPQL String/query to the session to be parsed after descriptors are initialized.

public void
addQuery(String name, DatabaseQuery query)

PUBLIC: Add the query to the session queries with the given name.

public void
clearIntegrityChecker()

PUBLIC: clear the integrityChecker, the integrityChecker holds all the ClassDescriptor Exceptions.

public void
clearProfile()

PUBLIC: Clear the profiler, this will end the current profile operation.

public boolean
containsQuery(String queryName)

PUBLIC: Return true if the pre-defined query is defined on the session.

public Object
copy(Object originalObjectOrObjects)

PUBLIC: Return a complete copy of the object or of collection of objects.

public Object
copy(Object originalObjectOrObjects, AttributeGroup group)

PUBLIC: Return a complete copy of the object or collection of objects.

public boolean
doesObjectExist(Object object)

PUBLIC: Return if the object exists on the database or not.

public void
dontLogMessages()

PUBLIC: Turn off logging

public int
executeNonSelectingCall(Call call)

PUBLIC: Execute the call on the database.

public void
executeNonSelectingSQL(String sqlString)

PUBLIC: Execute the non-selecting (update/DML) SQL string.

public Object
executeQuery(String queryName)

PUBLIC: Execute the pre-defined query by name and return the result.

public Object
executeQuery(String queryName, Class<?> domainClass)

PUBLIC: Execute the pre-defined query by name and return the result.

public Object
executeQuery(String queryName, Class<?> domainClass, Object arg1)

PUBLIC: Execute the pre-defined query by name and return the result.

public Object
executeQuery(String queryName, Class<?> domainClass, Object arg1, Object arg2)

PUBLIC: Execute the pre-defined query by name and return the result.

public Object
executeQuery(String queryName, Class<?> domainClass, Object arg1, Object arg2, Object arg3)

PUBLIC: Execute the pre-defined query by name and return the result.

public Object
executeQuery(String queryName, Class<?> domainClass, List<E> argumentValues)

PUBLIC: Execute the pre-defined query by name and return the result.

public Object
executeQuery(String queryName, Object arg1)

PUBLIC: Execute the pre-defined query by name and return the result.

public Object
executeQuery(String queryName, Object arg1, Object arg2)

PUBLIC: Execute the pre-defined query by name and return the result.

public Object
executeQuery(String queryName, Object arg1, Object arg2, Object arg3)

PUBLIC: Execute the pre-defined query by name and return the result.

public Object
executeQuery(String queryName, List<E> argumentValues)

PUBLIC: Execute the pre-defined query by name and return the result.

public Object
executeQuery(DatabaseQuery query)

PUBLIC: Execute the database query.

public Object
executeQuery(DatabaseQuery query, List<E> argumentValues)

PUBLIC: Return the results from executing the database query.

public Vector<E>
executeSelectingCall(Call call)

PUBLIC: Execute the call on the database and return the result.

public Vector<E>
executeSQL(String sqlString)

PUBLIC: Execute the selecting SQL string.

public Session
getActiveSession()

PUBLIC: Return the active session for the current active external (JTS) transaction.

public UnitOfWork
getActiveUnitOfWork()

PUBLIC: Return the active unit of work for the current active external (JTS) transaction.

public AsOfClause

Returns:

An immutable object representation of the past time. null if no clause set, or this a regular session.
getAsOfClause
()

ADVANCED: Answers the past time this session is as of.

public ClassDescriptor
getClassDescriptor(Class<?> theClass)

ADVANCED: Return the descriptor specified for the class.

public ClassDescriptor
getClassDescriptor(Object domainObject)

ADVANCED: Return the descriptor specified for the object's class.

public ClassDescriptor
getClassDescriptorForAlias(String alias)

PUBLIC: Return the descriptor for the alias.

public Login
getDatasourceLogin()

Redeclares org.eclipse.persistence.core.sessions.CoreSession.getDatasourceLogin.

PUBLIC: Return the login, the login holds any database connection information given.
public Platform
getDatasourcePlatform()

Redeclares org.eclipse.persistence.core.sessions.CoreSession.getDatasourcePlatform.

PUBLIC: Return the database platform currently connected to.
public ReferenceMode
getDefaultReferenceMode()

Stores the default Session wide reference mode that a UnitOfWork will use when referencing managed objects.

public ClassDescriptor
getDescriptor(Class<?> theClass)

Redeclares org.eclipse.persistence.core.sessions.CoreSession.getDescriptor.

ADVANCED: Return the descriptor specified for the class.
public ClassDescriptor
getDescriptor(Object domainObject)

Redeclares org.eclipse.persistence.core.sessions.CoreSession.getDescriptor.

ADVANCED: Return the descriptor specified for the object's class.
public ClassDescriptor
getDescriptorForAlias(String alias)

PUBLIC: Return the descriptor for the alias.

public Map<Class<?>, ClassDescriptor>
getDescriptors()

Redeclares org.eclipse.persistence.core.sessions.CoreSession.getDescriptors.

ADVANCED: Return all registered descriptors.
public SessionEventManager
public ExceptionHandler
getExceptionHandler()

PUBLIC: Return the ExceptionHandler.Exception handler can catch errors that occur on queries or during database access.

public ExternalTransactionController
getExternalTransactionController()

PUBLIC: Used for JTS integration.

public Object
getId(Object domainObject)

ADVANCED: Extract and return the Id from the object.

public IdentityMapAccessor
getIdentityMapAccessor()

PUBLIC: The IdentityMapAccessor is the preferred way of accessing IdentityMap functions This will return an object which implements an interface which exposes all public IdentityMap functions.

public IntegrityChecker
getIntegrityChecker()

PUBLIC: Returns the integrityChecker,the integrityChecker holds all the ClassDescriptor Exceptions.

public List<DatabaseQuery>
getJPAQueries()

ADVANCED: Return all pre-defined not yet parsed EJBQL queries.

public Writer
getLog()

PUBLIC: Return the writer to which an accessor writes logged messages and SQL.

public DatabaseLogin
getLogin()

PUBLIC: Return the login, the login holds any database connection information given.

public int
getLogLevel(String category)

PUBLIC: Return the log level.

public int
getLogLevel()

PUBLIC: Return the log level.

public String
getName()

PUBLIC: Return the name of the session.

public Number
getNextSequenceNumberValue(Class<?> domainClass)

ADVANCED: Return the sequence number from the database.

public PartitioningPolicy
getPartitioningPolicy()

PUBLIC: Return the session's partitioning policy.

public DatabasePlatform
getPlatform()

PUBLIC: Return the database platform currently connected to.

public SessionProfiler
getProfiler()

PUBLIC: Return the profiler.

public Project
public Map<String, Object>
getProperties()

ADVANCED: Allow for user defined properties.

public Object
getProperty(String name)

ADVANCED: Returns the user defined property.

public Map<String, List<DatabaseQuery>>
getQueries()

ADVANCED: Return all pre-defined queries.

public DatabaseQuery
getQuery(String name)

PUBLIC: Return the query from the session pre-defined queries with the given name.

public DatabaseQuery
getQuery(String name, List<E> arguments)

PUBLIC: Return the query from the session pre-defined queries with the given name.

public Serializer
getSerializer()

Return the Serializer to use by default for serialization.

public ServerPlatform
getServerPlatform()

PUBLIC: Return the server platform currently used.

public SessionLog
getSessionLog()

PUBLIC: Return the session log to which an accessor logs messages and SQL.

public Object
handleException(RuntimeException exception)

PUBLIC: Allow any WARNING level exceptions that occur within EclipseLink to be logged and handled by the exception handler.

public Object
handleSevere(RuntimeException exception)

PUBLIC: Allow any SEVERE level exceptions that occur within EclipseLink to be logged and handled by the exception handler.

public boolean
hasDescriptor(Class<?> theClass)

ADVANCED: Return true if a descriptor exists for the given class.

public boolean
hasExceptionHandler()

PUBLIC: Return if an exception handler is present.

public boolean
hasExternalTransactionController()

PUBLIC: Used for JTS integration.

public boolean
isClientSession()

PUBLIC: Return if this session is a client session.

public boolean
isConnected()

PUBLIC: Return if this session is connected to the database.

public boolean
isDatabaseSession()

PUBLIC: Return if this session is a database session.

public boolean
isDistributedSession()

PUBLIC: Return if this session is a distributed session.

public boolean
isFinalizersEnabled()

PUBLIC: Return if this session's descendants should use finalizers.

public boolean
isInProfile()

PUBLIC: Return if a profiler is being used.

public boolean
isRemoteSession()

PUBLIC: Return if this session is a remote session.

public boolean
isRemoteUnitOfWork()

PUBLIC: Return if this session is a remote unit of work.

public boolean
isServerSession()

PUBLIC: Return if this session is a server session.

public boolean
isSessionBroker()

PUBLIC: Return if this session is a session broker.

public boolean
isUnitOfWork()

PUBLIC: Return if this session is a unit of work.

public void
log(SessionLogEntry entry)

PUBLIC: Log the log entry.

public void
logMessage(String message)

Log a untranslated message to the EclipseLink log at FINER level.

public Vector<E>
readAllObjects(Class<?> domainClass)

PUBLIC: Read all of the instances of the class from the database.

public Vector<E>
readAllObjects(Class<?> domainClass, Call aCall)

PUBLIC: Read all the instances of the class from the database returned through execution the Call string.

public Vector<E>
readAllObjects(Class<?> domainClass, Expression selectionCriteria)

PUBLIC: Read all of the instances of the class from the database matching the given expression.

public Object
readObject(Class<?> domainClass)

PUBLIC: Read the first instance of the class from the database.

public Object
readObject(Class<?> domainClass, Call aCall)

PUBLIC: Read the first instance of the class from the database returned through execution the Call string.

public Object
readObject(Class<?> domainClass, Expression selectionCriteria)

PUBLIC: Read the first instance of the class from the database matching the given expression.

public Object
readObject(Object object)

PUBLIC: Use the example object to construct a read object query by the objects primary key.

public Object
refreshObject(Object object)

PUBLIC: Refresh the attributes of the object and of all of its private parts from the database.

public void
release()

PUBLIC: Release the session.

public void
removeProperty(String property)

PUBLIC: Remove the user defined property.

public void
removeQuery(String queryName)

PUBLIC: Remove the query name from the set of pre-defined queries

public void
setDefaultReferenceMode(ReferenceMode defaultReferenceMode)

Stores the default Session wide reference mode that a UnitOfWork will use when referencing managed objects.

public void
setExceptionHandler(ExceptionHandler exceptionHandler)

PUBLIC: Set the exceptionHandler.

public void
setExternalTransactionController(ExternalTransactionController externalTransactionController)

OBSOLETE: Previously used for JTS integration.

public void
setIntegrityChecker(IntegrityChecker integrityChecker)

PUBLIC: Set the integrityChecker, the integrityChecker holds all the ClassDescriptor Exceptions.

public void
setIsFinalizersEnabled(boolean isFinalizersEnabled)

PUBLIC: Set if this session's descendants should use finalizers.

public void
setLog(Writer log)

PUBLIC: Set the writer to which an accessor writes logged messages and SQL.

public void
setLogLevel(int level)

Redeclares org.eclipse.persistence.core.sessions.CoreSession.setLogLevel.

PUBLIC: Set the log level.
public void
setName(String name)

PUBLIC: Set the name of the session.

public void
setPartitioningPolicy(PartitioningPolicy partitioningPolicy)

PUBLIC: Set the session's partitioning policy.

public void
setProfiler(SessionProfiler profiler)

PUBLIC: Set the profiler for the session.

public void
setProperty(String propertyName, Object propertyValue)

PUBLIC: Allow for user defined properties.

public void
setQueryTimeoutDefault(int queryTimeoutDefault)

PUBLIC: Set the default query timeout for this session.

public void
setQueryTimeoutUnitDefault(TimeUnit queryTimeoutDefault)

PUBLIC: Set the default query timeout units for this session.

public void
setSerializer(Serializer serializer)

Set the Serializer to use by default for serialization.

public void
setSessionLog(SessionLog sessionLog)

PUBLIC: Set the session log to which an accessor logs messages and SQL.

public boolean
shouldLog(int Level, String category)

PUBLIC: Check if a message of the given level would actually be logged.

public boolean
shouldLogMessages()

PUBLIC: Return if logging is enabled (false if log level is OFF)

public void
validateCache()

ADVANCED: This can be used to help debugging an object identity problem.