Interface Session
- All Superinterfaces:
CoreSession<ClassDescriptor,
Login, org.eclipse.persistence.internal.databaseaccess.Platform, Project, SessionEventManager>
- All Known Subinterfaces:
DatabaseSession
,Server
,UnitOfWork
- All Known Implementing Classes:
org.eclipse.persistence.internal.sessions.AbstractSession
,ClientSession
,org.eclipse.persistence.internal.sessions.DatabaseSessionImpl
,DistributedSession
,RemoteSession
,ServerSession
,SessionBroker
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:
- Define the API for all reading, units of work.
- See Also:
-
UnitOfWork
DatabaseSession
AbstractSession
DatabaseSessionImpl
ServerSession
ClientSession
-
Method Summary
Modifier and TypeMethodDescriptionacquireHistoricalSession
(AsOfClause pastTime) ADVANCED: Returns a light weight read-only session where all objects are automatically read as of the specified past time.PUBLIC: Return a unit of work for this session.acquireUnitOfWork
(ReferenceMode referenceMode) PUBLIC: Return a unit of work for this session.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.void
addQuery
(String name, DatabaseQuery query) PUBLIC: Add the query to the session queries with the given name.void
PUBLIC: clear the integrityChecker, the integrityChecker holds all the ClassDescriptor Exceptions.void
PUBLIC: Clear the profiler, this will end the current profile operation.boolean
containsQuery
(String queryName) PUBLIC: Return true if the pre-defined query is defined on the session.PUBLIC: Return a complete copy of the object or of collection of objects.copy
(Object originalObjectOrObjects, AttributeGroup group) PUBLIC: Return a complete copy of the object or collection of objects.boolean
doesObjectExist
(Object object) PUBLIC: Return if the object exists on the database or not.void
PUBLIC: Turn off loggingint
executeNonSelectingCall
(Call call) PUBLIC: Execute the call on the database.void
executeNonSelectingSQL
(String sqlString) PUBLIC: Execute the non-selecting (update/DML) SQL string.executeQuery
(String queryName) PUBLIC: Execute the pre-defined query by name and return the result.executeQuery
(String queryName, Class domainClass) PUBLIC: Execute the pre-defined query by name and return the result.executeQuery
(String queryName, Class domainClass, Object arg1) PUBLIC: Execute the pre-defined query by name and return the result.executeQuery
(String queryName, Class domainClass, Object arg1, Object arg2) PUBLIC: Execute the pre-defined query by name and return the result.PUBLIC: Execute the pre-defined query by name and return the result.executeQuery
(String queryName, Class domainClass, List argumentValues) PUBLIC: Execute the pre-defined query by name and return the result.executeQuery
(String queryName, Object arg1) PUBLIC: Execute the pre-defined query by name and return the result.executeQuery
(String queryName, Object arg1, Object arg2) PUBLIC: Execute the pre-defined query by name and return the result.executeQuery
(String queryName, Object arg1, Object arg2, Object arg3) PUBLIC: Execute the pre-defined query by name and return the result.executeQuery
(String queryName, List argumentValues) PUBLIC: Execute the pre-defined query by name and return the result.executeQuery
(DatabaseQuery query) PUBLIC: Execute the database query.executeQuery
(DatabaseQuery query, List argumentValues) PUBLIC: Return the results from executing the database query.executeSelectingCall
(Call call) PUBLIC: Execute the call on the database and return the result.executeSQL
(String sqlString) PUBLIC: Execute the selecting SQL string.PUBLIC: Return the active session for the current active external (JTS) transaction.PUBLIC: Return the active unit of work for the current active external (JTS) transaction.ADVANCED: Answers the past time this session is as of.getClassDescriptor
(Class theClass) ADVANCED: Return the descriptor specified for the class.getClassDescriptor
(Object domainObject) ADVANCED: Return the descriptor specified for the object's class.getClassDescriptorForAlias
(String alias) PUBLIC: Return the descriptor for the alias.PUBLIC: Return the login, the login holds any database connection information given.org.eclipse.persistence.internal.databaseaccess.Platform
PUBLIC: Return the database platform currently connected to.Stores the default Session wide reference mode that a UnitOfWork will use when referencing managed objects.getDescriptor
(Class theClass) ADVANCED: Return the descriptor specified for the class.getDescriptor
(Object domainObject) ADVANCED: Return the descriptor specified for the object's class.getDescriptorForAlias
(String alias) PUBLIC: Return the descriptor for the alias.ADVANCED: Return all registered descriptors.PUBLIC: Return the event manager.PUBLIC: Return the ExceptionHandler.Exception handler can catch errors that occur on queries or during database access.PUBLIC: Used for JTS integration.ADVANCED: Extract and return the Id from the object.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: Returns the integrityChecker,the integrityChecker holds all the ClassDescriptor Exceptions.ADVANCED: Return all pre-defined not yet parsed EJBQL queries.getLog()
PUBLIC: Return the writer to which an accessor writes logged messages and SQL.getLogin()
PUBLIC: Return the login, the login holds any database connection information given.int
PUBLIC: Return the log level.int
getLogLevel
(String category) PUBLIC: Return the log level.getName()
PUBLIC: Return the name of the session.getNextSequenceNumberValue
(Class domainClass) ADVANCED: Return the sequence number from the database.PUBLIC: Return the session's partitioning policy.PUBLIC: Return the database platform currently connected to.PUBLIC: Return the profiler.PUBLIC: Return the project.ADVANCED: Allow for user defined properties.getProperty
(String name) ADVANCED: Returns the user defined property.ADVANCED: Return all pre-defined queries.PUBLIC: Return the query from the session pre-defined queries with the given name.PUBLIC: Return the query from the session pre-defined queries with the given name.Return the Serializer to use by default for serialization.PUBLIC: Return the server platform currently used.PUBLIC: Return the session log to which an accessor logs messages and SQL.handleException
(RuntimeException exception) PUBLIC: Allow any WARNING level exceptions that occur within EclipseLink to be logged and handled by the exception handler.handleSevere
(RuntimeException exception) PUBLIC: Allow any SEVERE level exceptions that occur within EclipseLink to be logged and handled by the exception handler.boolean
hasDescriptor
(Class theClass) ADVANCED: Return true if a descriptor exists for the given class.boolean
PUBLIC: Return if an exception handler is present.boolean
PUBLIC: Used for JTS integration.boolean
PUBLIC: Return if this session is a client session.boolean
PUBLIC: Return if this session is connected to the database.boolean
PUBLIC: Return if this session is a database session.boolean
PUBLIC: Return if this session is a distributed session.boolean
PUBLIC: Return if this session's descendants should use finalizers.boolean
PUBLIC: Return if a profiler is being used.boolean
PUBLIC: Return if this session is a remote session.boolean
PUBLIC: Return if this session is a remote unit of work.boolean
PUBLIC: Return if this session is a server session.boolean
PUBLIC: Return if this session is a session broker.boolean
PUBLIC: Return if this session is a unit of work.void
log
(SessionLogEntry entry) PUBLIC: Log the log entry.void
logMessage
(String message) Log a untranslated message to the EclipseLink log at FINER level.readAllObjects
(Class domainClass) PUBLIC: Read all of the instances of the class from the database.readAllObjects
(Class domainClass, Expression selectionCriteria) PUBLIC: Read all of the instances of the class from the database matching the given expression.readAllObjects
(Class domainClass, Call aCall) PUBLIC: Read all the instances of the class from the database returned through execution the Call string.readObject
(Class domainClass) PUBLIC: Read the first instance of the class from the database.readObject
(Class domainClass, Expression selectionCriteria) PUBLIC: Read the first instance of the class from the database matching the given expression.readObject
(Class domainClass, Call aCall) PUBLIC: Read the first instance of the class from the database returned through execution the Call string.readObject
(Object object) PUBLIC: Use the example object to construct a read object query by the objects primary key.refreshObject
(Object object) PUBLIC: Refresh the attributes of the object and of all of its private parts from the database.void
release()
PUBLIC: Release the session.void
removeProperty
(String property) PUBLIC: Remove the user defined property.void
removeQuery
(String queryName) PUBLIC: Remove the query name from the set of pre-defined queriesvoid
setDefaultReferenceMode
(ReferenceMode defaultReferenceMode) Stores the default Session wide reference mode that a UnitOfWork will use when referencing managed objects.void
setExceptionHandler
(ExceptionHandler exceptionHandler) PUBLIC: Set the exceptionHandler.void
setExternalTransactionController
(ExternalTransactionController externalTransactionController) OBSOLETE: Previously used for JTS integration.void
setIntegrityChecker
(IntegrityChecker integrityChecker) PUBLIC: Set the integrityChecker, the integrityChecker holds all the ClassDescriptor Exceptions.void
setIsFinalizersEnabled
(boolean isFinalizersEnabled) PUBLIC: Set if this session's descendants should use finalizers.void
PUBLIC: Set the writer to which an accessor writes logged messages and SQL.void
setLogLevel
(int level) PUBLIC: Set the log level.void
PUBLIC: Set the name of the session.void
setPartitioningPolicy
(PartitioningPolicy partitioningPolicy) PUBLIC: Set the session's partitioning policy.void
setProfiler
(SessionProfiler profiler) PUBLIC: Set the profiler for the session.void
setProperty
(String propertyName, Object propertyValue) PUBLIC: Allow for user defined properties.void
setQueryTimeoutDefault
(int queryTimeoutDefault) PUBLIC: Set the default query timeout for this session.void
setQueryTimeoutUnitDefault
(TimeUnit queryTimeoutDefault) PUBLIC: Set the default query timeout units for this session.void
setSerializer
(Serializer serializer) Set the Serializer to use by default for serialization.void
setSessionLog
(SessionLog sessionLog) PUBLIC: Set the session log to which an accessor logs messages and SQL.boolean
PUBLIC: Check if a message of the given level would actually be logged.boolean
PUBLIC: Return if logging is enabled (false if log level is OFF)void
ADVANCED: This can be used to help debugging an object identity problem.
-
Method Details
-
acquireHistoricalSession
ADVANCED: Returns a light weight read-only session where all objects are automatically read as of the specified past time.Use this Session to take advantage of Oracle 9 Release 2 Flashback or EclipseLink general history support and still be able to cache query results.
A special historical session is required as all objects read may be of different versions than those stored in the global session cache. Hence also known as IsolationSession, as all reads bypass the global cache.
An AsOfClause at the Session level will override any clauses set at the query or expression levels.
Example: Using a historical session to read past versions of objects.
AsOfClause pastTime = new AsOfClause(System.currentTimeMillis() - 24*60*60*1000); Session historicalSession = session.acquireSessionAsOf(pastTime); Employee pastEmployee = (Employee)historicalSession.readObject(Employee.class); Address pastAddress = pastEmployee.getAddress(); Vector pastProjects = pastEmployee.getProjects(); historicalSession.release();
Example: Using the above past employee to recover objects.
UnitOfWork uow = baseSession.acquireUnitOfWork(); Employee presentClone = (Employee)uow.readObject(pastEmployee); uow.deepMergeClone(pastEmployee); uow.commit();
By definition all data as of a past time is frozen. So this session is also ideal for read consistent queries and read only transactions, as all queries will be against a consistent and immutable snap shot of the data.
- Parameters:
pastTime
- Represents a valid snap shot time.- Throws:
ValidationException
- ifthis
not a ClientSession, plain Session, or SessionBroker.- See Also:
-
acquireUnitOfWork
UnitOfWork acquireUnitOfWork()PUBLIC: Return a unit of work for this session. The unit of work is an object level transaction that allows a group of changes to be applied as a unit. The return value should be used as the org.eclipse.persistence.sessions.UnitOfWork interface- See Also:
-
acquireUnitOfWork
PUBLIC: Return a unit of work for this session. The unit of work is an object level transaction that allows a group of changes to be applied as a unit.- Parameters:
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.- See Also:
-
UnitOfWorkImpl
-
addQuery
PUBLIC: Add the query to the session queries with the given name. This allows for common queries to be pre-defined, reused and executed by name. -
addJPAQuery
ADVANCED: Add a pre-defined not yet parsed JPQL String/query to the session to be parsed after descriptors are initialized. -
clearIntegrityChecker
void clearIntegrityChecker()PUBLIC: clear the integrityChecker, the integrityChecker holds all the ClassDescriptor Exceptions. -
clearProfile
void clearProfile()PUBLIC: Clear the profiler, this will end the current profile operation. -
containsQuery
PUBLIC: Return true if the pre-defined query is defined on the session. -
copy
PUBLIC: Return a complete copy of the object or of collection of objects. In case of collection all members should be either entities of the same type or have a common inheritance hierarchy mapped root class. This can be used to obtain a scratch copy of an object, or for templatizing an existing object into another new object. The object and all of its privately owned parts will be copied.- See Also:
-
copy
PUBLIC: Return a complete copy of the object or collection of objects. In case of collection all members should be either entities of the same type or have a common inheritance hierarchy mapped root class. This can be used to obtain a scratch copy of an object, or for templatizing an existing object into another new object. If there are no attributes in the group then the object and all of its privately owned parts will be copied. Otherwise only the attributes included into the group will be copied. -
doesObjectExist
PUBLIC: Return if the object exists on the database or not. This always checks existence on the database.- Throws:
DatabaseException
-
dontLogMessages
void dontLogMessages()PUBLIC: Turn off logging -
executeNonSelectingCall
PUBLIC: Execute the call on the database. The row count is returned. The call can be a stored procedure call, SQL call or other type of call.Example:
session.executeNonSelectingCall(new SQLCall("Delete from Employee");
- See Also:
-
executeNonSelectingSQL
PUBLIC: Execute the non-selecting (update/DML) SQL string. Warning: Allowing an unverified SQL string to be passed into this method makes your application vulnerable to SQL injection attacks. -
executeQuery
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse.- See Also:
-
executeQuery
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse. The class is the descriptor in which the query was pre-defined. -
executeQuery
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse. The class is the descriptor in which the query was pre-defined. -
executeQuery
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse. The class is the descriptor in which the query was pre-defined. -
executeQuery
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse. The class is the descriptor in which the query was pre-defined. -
executeQuery
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse. The class is the descriptor in which the query was pre-defined. -
executeQuery
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse.- See Also:
-
executeQuery
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse.- See Also:
-
executeQuery
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse.- See Also:
-
executeQuery
PUBLIC: Execute the pre-defined query by name and return the result. Queries can be pre-defined and named to allow for their reuse.- See Also:
-
executeQuery
PUBLIC: Execute the database query. A query is a database operation such as reading or writing. The query allows for the operation to be customized for such things as, performance, depth, caching, etc.- Throws:
EclipseLinkException
- See Also:
-
executeQuery
PUBLIC: Return the results from executing the database query. the arguments are passed in as a vector -
executeSelectingCall
PUBLIC: Execute the call on the database and return the result. The call must return a value, if no value is return executeNonSelectCall must be used. The call can be a stored procedure call, SQL call or other type of call. A vector of database rows is returned, database row implements Java 2 Map which should be used to access the data.Example:
session.executeSelectingCall(new SQLCall("Select * from Employee");
- See Also:
-
executeSQL
PUBLIC: Execute the selecting SQL string. A Vector of DatabaseRecords are returned. Warning: Allowing an unverified SQL string to be passed into this method makes your application vulnerable to SQL injection attacks. -
getActiveSession
Session getActiveSession()PUBLIC: Return the active session for the current active external (JTS) transaction. This should only be used with JTS and will return the session if no external transaction exists. -
getActiveUnitOfWork
UnitOfWork getActiveUnitOfWork()PUBLIC: Return the active unit of work for the current active external (JTS) transaction. This should only be used with JTS and will return null if no external transaction exists. -
getClassDescriptor
ADVANCED: Return the descriptor specified for the class. If the class does not have a descriptor but implements an interface that is also implemented by one of the classes stored in the map, that descriptor will be stored under the new class. -
getClassDescriptor
ADVANCED: Return the descriptor specified for the object's class. -
getClassDescriptorForAlias
PUBLIC: Return the descriptor for the alias. -
getAsOfClause
AsOfClause getAsOfClause()ADVANCED: Answers the past time this session is as of. Indicates whether or not this is a special historical session where all objects are read relative to a particular point in time.- Returns:
- An immutable object representation of the past time.
null
if no clause set, or this a regular session. - See Also:
-
getDefaultReferenceMode
ReferenceMode getDefaultReferenceMode()Stores the default Session wide reference mode that a UnitOfWork will use when referencing managed objects.- See Also:
-
getDescriptor
ADVANCED: Return the descriptor specified for the class. If the class does not have a descriptor but implements an interface that is also implemented by one of the classes stored in the map, that descriptor will be stored under the new class.- Specified by:
getDescriptor
in interfaceCoreSession<ClassDescriptor,
Login, org.eclipse.persistence.internal.databaseaccess.Platform, Project, SessionEventManager>
-
getDescriptor
ADVANCED: Return the descriptor specified for the object's class.- Specified by:
getDescriptor
in interfaceCoreSession<ClassDescriptor,
Login, org.eclipse.persistence.internal.databaseaccess.Platform, Project, SessionEventManager>
-
getDescriptorForAlias
PUBLIC: Return the descriptor for the alias. UnitOfWork delegates this to the parent -
getDescriptors
Map<Class,ClassDescriptor> getDescriptors()ADVANCED: Return all registered descriptors.- Specified by:
getDescriptors
in interfaceCoreSession<ClassDescriptor,
Login, org.eclipse.persistence.internal.databaseaccess.Platform, Project, SessionEventManager>
-
getJPAQueries
List<DatabaseQuery> getJPAQueries()ADVANCED: Return all pre-defined not yet parsed EJBQL queries. -
getEventManager
SessionEventManager getEventManager()PUBLIC: Return the event manager. The event manager can be used to register for various session events.- Specified by:
getEventManager
in interfaceCoreSession<ClassDescriptor,
Login, org.eclipse.persistence.internal.databaseaccess.Platform, Project, SessionEventManager>
-
getExceptionHandler
ExceptionHandler getExceptionHandler()PUBLIC: Return the ExceptionHandler.Exception handler can catch errors that occur on queries or during database access. -
getExternalTransactionController
ExternalTransactionController getExternalTransactionController()PUBLIC: Used for JTS integration. If your application requires to have JTS control transactions instead of EclipseLink an external transaction controller must be specified. EclipseLink provides JTS controllers for JTS 1.0 and Weblogic's JTS.- See Also:
-
getIdentityMapAccessor
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. -
getIntegrityChecker
IntegrityChecker getIntegrityChecker()PUBLIC: Returns the integrityChecker,the integrityChecker holds all the ClassDescriptor Exceptions. -
getLog
Writer getLog()PUBLIC: Return the writer to which an accessor writes logged messages and SQL. If not set, this reference defaults to a writer on System.out. To enable logging logMessages must be turned on.- See Also:
-
getPlatform
DatabasePlatform getPlatform()PUBLIC: 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. -
getDatasourcePlatform
org.eclipse.persistence.internal.databaseaccess.Platform getDatasourcePlatform()PUBLIC: Return the database platform currently connected to. The platform is used for database specific behavior.- Specified by:
getDatasourcePlatform
in interfaceCoreSession<ClassDescriptor,
Login, org.eclipse.persistence.internal.databaseaccess.Platform, Project, SessionEventManager>
-
getLogin
DatabaseLogin getLogin()PUBLIC: Return the login, the login holds any database connection information given. NOTE: this must only be used for relational specific usage, it will fail for non-relational datasources. -
getDatasourceLogin
Login getDatasourceLogin()PUBLIC: Return the login, the login holds any database connection information given. This return the Login interface and may need to be cast to the datasource specific implementation.- Specified by:
getDatasourceLogin
in interfaceCoreSession<ClassDescriptor,
Login, org.eclipse.persistence.internal.databaseaccess.Platform, Project, SessionEventManager>
-
getName
String getName()PUBLIC: Return the name of the session. This is used with the session broker, or to give the session a more meaningful name. -
getNextSequenceNumberValue
ADVANCED: Return the sequence number from the database. -
getProfiler
SessionProfiler getProfiler()PUBLIC: Return the profiler. The profiler is a tool that can be used to determine performance bottlenecks. The profiler can be queries to print summaries and configure for logging purposes. -
getProject
Project getProject()PUBLIC: Return the project. The project includes the login and descriptor and other configuration information.- Specified by:
getProject
in interfaceCoreSession<ClassDescriptor,
Login, org.eclipse.persistence.internal.databaseaccess.Platform, Project, SessionEventManager>
-
getProperties
ADVANCED: Allow for user defined properties. -
getProperty
ADVANCED: Returns the user defined property. -
getQueries
Map<String,List<DatabaseQuery>> getQueries()ADVANCED: Return all pre-defined queries. -
getQuery
PUBLIC: Return the query from the session pre-defined queries with the given name. This allows for common queries to be pre-defined, reused and executed by name. -
getQuery
PUBLIC: Return the query from the session pre-defined queries with the given name. This allows for common queries to be pre-defined, reused and executed by name. -
getServerPlatform
ServerPlatform getServerPlatform()PUBLIC: Return the server platform currently used. The server platform is used for application server specific behavior. -
getSessionLog
SessionLog getSessionLog()PUBLIC: Return the session log to which an accessor logs messages and SQL. If not set, this will default to a session log on a writer on System.out. To enable logging, logMessages must be turned on.- See Also:
-
handleException
PUBLIC: Allow any WARNING level exceptions that occur within EclipseLink to be logged and handled by the exception handler.- Throws:
RuntimeException
-
hasDescriptor
ADVANCED: Return true if a descriptor exists for the given class. -
hasExceptionHandler
boolean hasExceptionHandler()PUBLIC: Return if an exception handler is present. -
hasExternalTransactionController
boolean hasExternalTransactionController()PUBLIC: Used for JTS integration. If your application requires to have JTS control transactions instead of EclipseLink an external transaction controller must be specified. EclipseLink provides JTS controllers for JTS 1.0 and Weblogic's JTS.- See Also:
-
isClientSession
boolean isClientSession()PUBLIC: Return if this session is a client session. -
isConnected
boolean isConnected()PUBLIC: Return if this session is connected to the database. -
isDatabaseSession
boolean isDatabaseSession()PUBLIC: Return if this session is a database session. -
isDistributedSession
boolean isDistributedSession()PUBLIC: Return if this session is a distributed session. -
isInProfile
boolean isInProfile()PUBLIC: Return if a profiler is being used. -
isRemoteSession
boolean isRemoteSession()PUBLIC: Return if this session is a remote session. -
isServerSession
boolean isServerSession()PUBLIC: Return if this session is a server session. -
isSessionBroker
boolean isSessionBroker()PUBLIC: Return if this session is a session broker. -
isUnitOfWork
boolean isUnitOfWork()PUBLIC: Return if this session is a unit of work. -
isRemoteUnitOfWork
boolean isRemoteUnitOfWork()PUBLIC: Return if this session is a remote unit of work. -
getId
ADVANCED: Extract and return the Id from the object.- Throws:
ValidationException
-
log
PUBLIC: Log the log entry. -
logMessage
Log a untranslated message to the EclipseLink log at FINER level. -
readAllObjects
PUBLIC: Read all of the instances of the class from the database. This operation can be customized through using a ReadAllQuery, or through also passing in a selection criteria.- Throws:
DatabaseException
- See Also:
-
readAllObjects
PUBLIC: Read all the instances of the class from the database returned through execution the Call string. The Call can be an SQLCall or JPQLCall. example: session.readAllObjects(Employee.class, new SQLCall("SELECT * FROM EMPLOYEE"));- Throws:
DatabaseException
- See Also:
-
readAllObjects
PUBLIC: Read all of the instances of the class from the database matching the given expression. This operation can be customized through using a ReadAllQuery.- Throws:
DatabaseException
- See Also:
-
readObject
PUBLIC: Read the first instance of the class from the database. This operation can be customized through using a ReadObjectQuery, or through also passing in a selection criteria. By default, this method executes a query without selection criteria and consequently it will always result in a database access even if an instance of the specified Class exists in the cache. Executing a query with selection criteria allows you to avoid a database access if the selected instance is in the cache. Because of this, you may wish to consider a readObject method that takes selection criteria, such as:readObject(Class, Call)
,readObject(Class, Expression)
, orreadObject(Object)
.- Throws:
DatabaseException
- See Also:
-
readObject
PUBLIC: Read the first instance of the class from the database returned through execution the Call string. The Call can be an SQLCall or JPQLCall. example: session.readObject(Employee.class, new SQLCall("SELECT * FROM EMPLOYEE"));- Throws:
DatabaseException
- See Also:
-
readObject
PUBLIC: Read the first instance of the class from the database matching the given expression. This operation can be customized through using a ReadObjectQuery.- Throws:
DatabaseException
- See Also:
-
readObject
PUBLIC: Use the example object to construct a read object query by the objects primary key. This will read the object from the database with the same primary key as the object or null if no object is found.- Throws:
DatabaseException
-
refreshObject
PUBLIC: Refresh the attributes of the object and of all of its private parts from the database. This can be used to ensure the object is up to date with the database. Caution should be used when using this to make sure the application has no uncommitted changes to the object. -
release
void release()PUBLIC: Release the session. This does nothing by default, but allows for other sessions such as the ClientSession to do something. -
removeProperty
PUBLIC: Remove the user defined property. -
removeQuery
PUBLIC: Remove the query name from the set of pre-defined queries -
setDefaultReferenceMode
Stores the default Session wide reference mode that a UnitOfWork will use when referencing managed objects.- See Also:
-
setExceptionHandler
PUBLIC: Set the exceptionHandler. Exception handler can catch errors that occur on queries or during database access. -
setExternalTransactionController
OBSOLETE: Previously used for JTS integration. If your application requires to have JTS control transactions a ServerPlatform must be specified before login, either via your sessions.xml or in code. A subclass of ServerPlatformBase should handle your requirements. If not, we suggest creating your own subclass of ServerPlatformBase to specify the external transaction controller class.- See Also:
-
setIntegrityChecker
PUBLIC: Set the integrityChecker, the integrityChecker holds all the ClassDescriptor Exceptions. -
setLog
PUBLIC: Set the writer to which an accessor writes logged messages and SQL. If not set, this reference defaults to a writer on System.out. To enable logging logMessages() is used.- See Also:
-
setName
PUBLIC: Set the name of the session. This is used with the session broker, or to give the session a more meaningful name. -
setProfiler
PUBLIC: Set the profiler for the session. This allows for performance operations to be profiled. -
setProperty
PUBLIC: Allow for user defined properties. -
setSessionLog
PUBLIC: Set the session log to which an accessor logs messages and SQL. If not set, this will default to a session log on a writer on System.out. To enable logging, logMessages must be turned on.- See Also:
-
shouldLogMessages
boolean shouldLogMessages()PUBLIC: Return if logging is enabled (false if log level is OFF) -
validateCache
void validateCache()ADVANCED: This can be used to help debugging an object identity problem. An object identity problem is when an object in the cache references an object not in the cache. This method will validate that all cached objects are in a correct state. -
getLogLevel
PUBLIC: Return the log level.
Possible values for log level and category are listed in SessionLog.- See Also:
-
getLogLevel
int getLogLevel()PUBLIC: Return the log level.
Possible values for log level are listed in SessionLog.- See Also:
-
setLogLevel
void setLogLevel(int level) PUBLIC: Set the log level.
Possible values for log level are listed in SessionLog.- Specified by:
setLogLevel
in interfaceCoreSession<ClassDescriptor,
Login, org.eclipse.persistence.internal.databaseaccess.Platform, Project, SessionEventManager> - See Also:
-
shouldLog
PUBLIC: Check if a message of the given level would actually be logged.
Possible values for log level and category are listed in SessionLog.- See Also:
-
handleSevere
PUBLIC: Allow any SEVERE level exceptions that occur within EclipseLink to be logged and handled by the exception handler.- Throws:
RuntimeException
-
isFinalizersEnabled
boolean isFinalizersEnabled()PUBLIC: Return if this session's descendants should use finalizers. The allows certain finalizers such as in ClientSession to be enabled. These are disable by default for performance reasons. -
setIsFinalizersEnabled
void setIsFinalizersEnabled(boolean isFinalizersEnabled) PUBLIC: Set if this session's descendants should use finalizers. The allows certain finalizers such as in ClientSession to be enabled. These are disable by default for performance reasons. -
setQueryTimeoutDefault
void setQueryTimeoutDefault(int queryTimeoutDefault) PUBLIC: Set the default query timeout for this session. This timeout will apply to any queries that do not have a timeout set, and that do not have a default timeout defined in their descriptor. -
setQueryTimeoutUnitDefault
PUBLIC: Set the default query timeout units for this session. This timeout unit will apply to any queries that do not have a unit value set, and that do not have a default timeout unit defined in their descriptor. -
getPartitioningPolicy
PartitioningPolicy getPartitioningPolicy()PUBLIC: Return the session's partitioning policy. -
setPartitioningPolicy
PUBLIC: Set the session's partitioning policy. A PartitioningPolicy is used to partition, load-balance or replicate data across multiple difference databases or across a database cluster such as Oracle RAC. Partitioning can provide improved scalability by allowing multiple database machines to service requests. -
getSerializer
Serializer getSerializer()Return the Serializer to use by default for serialization. -
setSerializer
Set the Serializer to use by default for serialization.
-