Oracle Fusion Middleware Java API Reference for Oracle TopLink
11g Release 1 (11.1.1)

B32476-03

oracle.toplink.sessions
Interface Session

All Known Subinterfaces:
DatabaseSession, Server, UnitOfWork
All Known Implementing Classes:
oracle.toplink.internal.sessions.AbstractSession, ClientSession, oracle.toplink.internal.sessions.DatabaseSessionImpl, DistributedSession, RemoteSession, Session, SessionBroker

public interface Session

Purpose: Define the TopLink session public interface.

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

Responsibilities:

See Also:
UnitOfWork, DatabaseSession, AbstractSession, DatabaseSessionImpl, oracle.toplink.threetier.ServerSession, ClientSession

Method Summary
 Session acquireHistoricalSession(AsOfClause pastTime)
          ADVANCED: Returns a light weight read-only session where all objects are automatically read as of the specified past time.
 UnitOfWork acquireUnitOfWork()
          Return a unit of work for this session.
 void addEjbqlPlaceHolderQuery(DatabaseQuery query)
          ADVANCED: Add a pre-defined not yet parsed EJBQL String/query to the session to be parsed after descriptors are initialized.
 void addQuery(java.lang.String name, DatabaseQuery query)
          Add the query to the session queries with the given name.
 void clearIntegrityChecker()
          clear the integrityChecker, the integrityChecker holds all the ClassDescriptor Exceptions.
 void clearProfile()
          Clear the profiler, this will end the current profile opperation.
 boolean containsObjectInIdentityMap(java.lang.Object domainObject)
          Deprecated.  
 boolean containsObjectInIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass)
          Deprecated.  
 boolean containsQuery(java.lang.String queryName)
          Return true if the pre-defined query is defined on the session.
 java.lang.Object copyObject(java.lang.Object original)
          Return a complete copy of the object.
 java.lang.Object copyObject(java.lang.Object original, ObjectCopyingPolicy policy)
          Return a complete copy of the object.
 boolean doesObjectExist(java.lang.Object object)
          Return if the object exists on the database or not.
 void dontLogMessages()
          Turn off logging
 int executeNonSelectingCall(Call call)
          Execute the call on the database.
 void executeNonSelectingSQL(java.lang.String sqlString)
          Execute the non-selecting (update/DML) SQL string.
 java.lang.Object executeQuery(DatabaseQuery query)
          Execute the database query.
 java.lang.Object executeQuery(DatabaseQuery query, java.util.Vector argumentValues)
          Return the results from exeucting the database query.
 java.lang.Object executeQuery(java.lang.String queryName)
          Execute the pre-defined query by name and return the result.
 java.lang.Object executeQuery(java.lang.String queryName, java.lang.Class domainClass)
          Execute the pre-defined query by name and return the result.
 java.lang.Object executeQuery(java.lang.String queryName, java.lang.Class domainClass, java.lang.Object arg1)
          Execute the pre-defined query by name and return the result.
 java.lang.Object executeQuery(java.lang.String queryName, java.lang.Class domainClass, java.lang.Object arg1, java.lang.Object arg2)
          Execute the pre-defined query by name and return the result.
 java.lang.Object executeQuery(java.lang.String queryName, java.lang.Class domainClass, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
          Execute the pre-defined query by name and return the result.
 java.lang.Object executeQuery(java.lang.String queryName, java.lang.Class domainClass, java.util.Vector argumentValues)
          Execute the pre-defined query by name and return the result.
 java.lang.Object executeQuery(java.lang.String queryName, java.lang.Object arg1)
          Execute the pre-defined query by name and return the result.
 java.lang.Object executeQuery(java.lang.String queryName, java.lang.Object arg1, java.lang.Object arg2)
          Execute the pre-defined query by name and return the result.
 java.lang.Object executeQuery(java.lang.String queryName, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
          Execute the pre-defined query by name and return the result.
 java.lang.Object executeQuery(java.lang.String queryName, java.util.Vector argumentValues)
          Execute the pre-defined query by name and return the result.
 java.util.Vector executeSelectingCall(Call call)
          Execute the call on the database and return the result.
 java.util.Vector executeSQL(java.lang.String sqlString)
          Execute the selecting SQL string.
 Session getActiveSession()
          Return the active session for the current active external (JTS) transaction.
 UnitOfWork getActiveUnitOfWork()
          Return the active unit of work for the current active external (JTS) transaction.
 java.util.Vector getAllFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record translationRow)
          Deprecated.  
 java.util.Vector getAllFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record translationRow, InMemoryQueryIndirectionPolicy valueHolderPolicy)
          Deprecated.  
 AsOfClause getAsOfClause()
          ADVANCED: Answers the past time this session is as of.
 CacheSynchronizationManager getCacheSynchronizationManager()
          Deprecated. since OracleAS TopLink 10g (10.1.3). This method is replaced by DatabaseSession.getCommandManager()
 ClassDescriptor getClassDescriptor(java.lang.Class theClass)
          ADVANCED: Return the descriptor specified for the class.
 ClassDescriptor getClassDescriptor(java.lang.Object domainObject)
          ADVANCED: Return the descriptor specified for the object's class.
 ClassDescriptor getClassDescriptorForAlias(java.lang.String alias)
          Return the descriptor for the alias.
 Login getDatasourceLogin()
          Return the login, the login holds any database connection information given.
 oracle.toplink.internal.databaseaccess.Platform getDatasourcePlatform()
          Return the database platform currently connected to.
 ClassDescriptor getDescriptor(java.lang.Class theClass)
          ADVANCED: Return the descriptor specified for the class.
 ClassDescriptor getDescriptor(java.lang.Object domainObject)
          ADVANCED: Return the descriptor specified for the object's class.
 ClassDescriptor getDescriptorForAlias(java.lang.String alias)
          Return the descriptor for the alias.
 java.util.Map getDescriptors()
          ADVANCED: Return all registered descriptors.
 java.util.List getEjbqlPlaceHolderQueries()
          ADVANCED: Return all pre-defined not yet parsed EJBQL queries.
 SessionEventManager getEventManager()
          Return the event manager.
 ExceptionHandler getExceptionHandler()
          Return the ExceptionHandler.Exception handler can catch errors that occur on queries or during database access.
 ExternalTransactionController getExternalTransactionController()
          Used for JTS integration.
 java.lang.Object getFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record translationRow)
          Deprecated. Since 3.6.3
 java.lang.Object getFromIdentityMap(Expression selectionCriteria, java.lang.Class theClass, Record translationRow, InMemoryQueryIndirectionPolicy valueHolderPolicy)
          Deprecated.  
 java.lang.Object getFromIdentityMap(java.lang.Object domainObject)
          Deprecated.  
 java.lang.Object getFromIdentityMap(java.util.Vector primaryKey, java.lang.Class theClass)
          Deprecated.  
 IdentityMapAccessor getIdentityMapAccessor()
          The IdentityMapAccessor is the preferred way of accessing IdentityMap funcitons This will return an object which implements an interface which exposes all public IdentityMap functions.
 IntegrityChecker getIntegrityChecker()
          Returns the integrityChecker,the integrityChecker holds all the ClassDescriptor Exceptions.
 java.io.Writer getLog()
          Return the writer to which an accessor writes logged messages and SQL.
 DatabaseLogin getLogin()
          Return the login, the login holds any database connection information given.
 int getLogLevel()
          Return the log level.
 int getLogLevel(java.lang.String category)
          Return the log level.
 java.lang.String getName()
          Return the name of the session.
 java.lang.Number getNextSequenceNumberValue(java.lang.Class domainClass)
          ADVANCED: Return the sequnce number from the database
 DatabasePlatform getPlatform()
          Return the database platform currently connected to.
 SessionProfiler getProfiler()
          Return the profiler.
 Project getProject()
          Return the project.
 java.util.Map getProperties()
          ADVANCED: Allow for user defined properties.
 java.lang.Object getProperty(java.lang.String name)
          ADVANCED: Returns the user defined property.
 java.util.Map getQueries()
          ADVANCED: Return all pre-defined queries.
 DatabaseQuery getQuery(java.lang.String name)
          Return the query from the session pre-defined queries with the given name.
 DatabaseQuery getQuery(java.lang.String name, java.util.Vector arguments)
          Return the query from the session pre-defined queries with the given name.
 ServerPlatform getServerPlatform()
          Return the server platform currently used.
 SessionLog getSessionLog()
          Return the session log to which an accessor logs messages and SQL.
 java.lang.Object getWriteLockValue(java.lang.Object domainObject)
          Deprecated.  
 java.lang.Object getWriteLockValue(java.util.Vector primaryKey, java.lang.Class theClass)
          Deprecated.  
 java.lang.Object handleException(java.lang.RuntimeException exception)
          Allow any WARNING level exceptions that occur within TopLink to be logged and handled by the exception handler.
 java.lang.Object handleSevere(java.lang.RuntimeException exception)
          Allow any SEVERE level exceptions that occur within TopLink to be logged and handled by the exception handler.
 boolean hasCacheSynchronizationManager()
          ADVANCED: Return true if a synchronisation policy exists
 boolean hasDescriptor(java.lang.Class theClass)
          ADVANCED: Return true if a descriptor exists for the given class.
 boolean hasExceptionHandler()
          Return if an exception handler is present.
 boolean hasExternalTransactionController()
          Used for JTS integration.
 void initializeAllIdentityMaps()
          Deprecated.  
 void initializeIdentityMap(java.lang.Class theClass)
          Deprecated.  
 void initializeIdentityMaps()
          Deprecated.  
 boolean isClientSession()
          Return if this session is a client session.
 boolean isConnected()
          Return if this session is connected to the database.
 boolean isDatabaseSession()
          Return if this session is a database session.
 boolean isDistributedSession()
          Return if this session is a distributed session.
 boolean isFinalizersEnabled()
          Return if this session's decendants should use finalizers.
 boolean isInProfile()
          Return if a profiler is being used.
 boolean isRemoteSession()
          Return if this session is a remote session.
 boolean isRemoteUnitOfWork()
          Return if this session is a remote unit of work.
 boolean isServerSession()
          Return if this session is a server session.
 boolean isSessionBroker()
          Return if this session is a session broker.
 boolean isUnitOfWork()
          Return if this session is a unit of work.
 java.util.Vector keyFromObject(java.lang.Object domainObject)
          ADVANCED: Extract and return the primary key from the object.
 void log(SessionLogEntry entry)
          Log the log entry.
 void log(SessionLogEntry entry)
          Deprecated. Replaced by log(oracle.toplink.logging.SessionLogEntry)
 void logDebug(java.lang.String message)
          Deprecated. No direct replacement, moved to internal AbstractSession.
 void logDebug(java.lang.String message, java.lang.Object[] arguments)
          Deprecated. No direct replacement, moved to internal AbstractSession.
 void logException(java.lang.Exception exception)
          Deprecated. No direct replacement, moved to internal AbstractSession.
 void logMessage(java.lang.String message)
          Log a untranslated message to the TopLink log at FINER level.
 void logMessage(java.lang.String message, java.lang.Object[] arguments)
          Deprecated. Replaced by log(int level, String category, String message, Object[] params)
 void logMessages()
          Deprecated. Replaced by setLogLevel(int level, String category);
 void printIdentityMap(java.lang.Class businessClass)
          Deprecated.  
 void printIdentityMaps()
          Deprecated.  
 java.lang.Object putInIdentityMap(java.lang.Object domainObject)
          Deprecated.  
 java.lang.Object putInIdentityMap(java.lang.Object domainObject, java.util.Vector key)
          Deprecated.  
 java.lang.Object putInIdentityMap(java.lang.Object domainObject, java.util.Vector key, java.lang.Object writeLockValue)
          Deprecated.  
 java.util.Vector readAllObjects(java.lang.Class domainClass)
          Read all of the instances of the class from the database.
 java.util.Vector readAllObjects(java.lang.Class domainClass, Call aCall)
          Read all the instances of the class from the database returned through execution the Call string.
 java.util.Vector readAllObjects(java.lang.Class domainClass, Expression selectionCriteria)
          Read all of the instances of the class from the database matching the given expression.
 java.util.Vector readAllObjects(java.lang.Class domainClass, java.lang.String sqlString)
          Deprecated. Replaced by readAllObjects(Class, Call)
 java.lang.Object readObject(java.lang.Class domainClass)
          Read the first instance of the class from the database.
 java.lang.Object readObject(java.lang.Class domainClass, Call aCall)
          Read the first instance of the class from the database returned through execution the Call string.
 java.lang.Object readObject(java.lang.Class domainClass, Expression selectionCriteria)
          Read the first instance of the class from the database matching the given expression.
 java.lang.Object readObject(java.lang.Class domainClass, java.lang.String sqlString)
          Deprecated. use readObject(Class domainClass, Call aCall)
 java.lang.Object readObject(java.lang.Object object)
          Use the example object to consruct a read object query by the objects primary key.
 java.lang.Object refreshObject(java.lang.Object object)
          Refresh the attributes of the object and of all of its private parts from the database.
 void release()
          Release the session.
 void removeFromIdentityMap(java.lang.Object domainObject)
          Deprecated.  
 void removeFromIdentityMap(java.util.Vector key, java.lang.Class theClass)
          Deprecated.  
 void removeProperty(java.lang.String property)
          Remove the user defined property.
 void removeQuery(java.lang.String queryName)
          Remove the query name from the set of pre-defined queries
 void setCacheSynchronizationManager(CacheSynchronizationManager synchronizationManager)
          Deprecated. since OracleAS TopLink 10g (10.1.3). This method is replaced by DatabaseSession.setCommandManager(CommandManager)
 void setExceptionHandler(ExceptionHandler exceptionHandler)
          Set the exceptionHandler.
 void setExternalTransactionController(ExternalTransactionController externalTransactionController)
          OBSOLETE: Previously used for JTS integration.
 void setIntegrityChecker(IntegrityChecker integrityChecker)
          Set the integrityChecker, the integrityChecker holds all the ClassDescriptor Exceptions.
 void setIsFinalizersEnabled(boolean isFinalizersEnabled)
          Set if this session's decendants should use finalizers.
 void setLog(java.io.Writer log)
          Set the writer to which an accessor writes logged messages and SQL.
 void setLogLevel(int level)
          Set the log level.
 void setName(java.lang.String name)
          Set the name of the session.
 void setProfiler(SessionProfiler profiler)
          Set the profiler for the session.
 void setProperty(java.lang.String propertyName, java.lang.Object propertyValue)
          Allow for user defined properties.
 void setSessionLog(SessionLog sessionLog)
          Set the session log to which an accessor logs messages and SQL.
 void setSessionLog(SessionLog sessionLog)
          Deprecated.  
 void setShouldLogMessages(boolean shouldLogMessages)
          Deprecated.  
 boolean shouldLog(int Level, java.lang.String category)
          Check if a message of the given level would actually be logged.
 boolean shouldLogMessages()
          Return if logging is enabled (false if log level is OFF)
 void updateWriteLockValue(java.lang.Object domainObject, java.lang.Object writeLockValue)
          Deprecated.  
 void updateWriteLockValue(java.util.Vector primaryKey, java.lang.Class theClass, java.lang.Object writeLockValue)
          Deprecated.  
 boolean usesExternalTransactionController()
          Deprecated. replaced by #hasExternalTransactionController()
 void validateCache()
          ADVANCED: This can be used to help debugging an object identity problem.
 

Method Detail

acquireHistoricalSession

Session acquireHistoricalSession(AsOfClause pastTime)
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 TopLink 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 - if this not a ClientSession, plain Session, or SessionBroker.
See Also:
AsOfClause, Expression.asOf(oracle.toplink.history.AsOfClause), ObjectLevelReadQuery.setAsOfClause(oracle.toplink.history.AsOfClause), HistoryPolicy

acquireUnitOfWork

UnitOfWork acquireUnitOfWork()
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 oracle.toplink.sessions.UnitOfWork interface

See Also:
UnitOfWork

addQuery

void addQuery(java.lang.String name,
              DatabaseQuery query)
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.


addEjbqlPlaceHolderQuery

void addEjbqlPlaceHolderQuery(DatabaseQuery query)
ADVANCED: Add a pre-defined not yet parsed EJBQL String/query to the session to be parsed after descriptors are initialized.

See Also:
#getAllQueries()

clearIntegrityChecker

void clearIntegrityChecker()
clear the integrityChecker, the integrityChecker holds all the ClassDescriptor Exceptions.


clearProfile

void clearProfile()
Clear the profiler, this will end the current profile opperation.


containsObjectInIdentityMap

boolean containsObjectInIdentityMap(java.lang.Object domainObject)
Deprecated. 

ADVANCED: Return if their is an object for the primary key.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

containsObjectInIdentityMap

boolean containsObjectInIdentityMap(java.util.Vector primaryKey,
                                    java.lang.Class theClass)
Deprecated. 

ADVANCED: Return if their is an object for the primary key.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

containsQuery

boolean containsQuery(java.lang.String queryName)
Return true if the pre-defined query is defined on the session.


copyObject

java.lang.Object copyObject(java.lang.Object original)
Return a complete copy of the object. This can be used to obtain a scatch 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, the object's primary key will be reset to null.

See Also:
copyObject(Object, ObjectCopyingPolicy)

copyObject

java.lang.Object copyObject(java.lang.Object original,
                            ObjectCopyingPolicy policy)
Return a complete copy of the object. This can be used to obtain a scatch copy of an object, or for templatizing an existing object into another new object. The object copying policy allow for the depth, and reseting of the primary key to null, to be specified.


doesObjectExist

boolean doesObjectExist(java.lang.Object object)
                        throws DatabaseException
Return if the object exists on the database or not. This always checks existence on the database.

Throws:
DatabaseException

dontLogMessages

void dontLogMessages()
Turn off logging


executeNonSelectingCall

int executeNonSelectingCall(Call call)
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:
executeSelectingCall(Call)

executeNonSelectingSQL

void executeNonSelectingSQL(java.lang.String sqlString)
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

java.lang.Object executeQuery(java.lang.String queryName)
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:
addQuery(String, DatabaseQuery)

executeQuery

java.lang.Object executeQuery(java.lang.String queryName,
                              java.lang.Class domainClass)
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.

See Also:
DescriptorQueryManager.addQuery(String, DatabaseQuery)

executeQuery

java.lang.Object executeQuery(java.lang.String queryName,
                              java.lang.Class domainClass,
                              java.lang.Object arg1)
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.

See Also:
DescriptorQueryManager.addQuery(String, DatabaseQuery)

executeQuery

java.lang.Object executeQuery(java.lang.String queryName,
                              java.lang.Class domainClass,
                              java.lang.Object arg1,
                              java.lang.Object arg2)
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.

See Also:
DescriptorQueryManager.addQuery(String, DatabaseQuery)

executeQuery

java.lang.Object executeQuery(java.lang.String queryName,
                              java.lang.Class domainClass,
                              java.lang.Object arg1,
                              java.lang.Object arg2,
                              java.lang.Object arg3)
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.

See Also:
DescriptorQueryManager.addQuery(String, DatabaseQuery)

executeQuery

java.lang.Object executeQuery(java.lang.String queryName,
                              java.lang.Class domainClass,
                              java.util.Vector argumentValues)
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.

See Also:
DescriptorQueryManager.addQuery(String, DatabaseQuery)

executeQuery

java.lang.Object executeQuery(java.lang.String queryName,
                              java.lang.Object arg1)
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:
addQuery(String, DatabaseQuery)

executeQuery

java.lang.Object executeQuery(java.lang.String queryName,
                              java.lang.Object arg1,
                              java.lang.Object arg2)
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:
addQuery(String, DatabaseQuery)

executeQuery

java.lang.Object executeQuery(java.lang.String queryName,
                              java.lang.Object arg1,
                              java.lang.Object arg2,
                              java.lang.Object arg3)
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:
addQuery(String, DatabaseQuery)

executeQuery

java.lang.Object executeQuery(java.lang.String queryName,
                              java.util.Vector argumentValues)
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:
addQuery(String, DatabaseQuery)

executeQuery

java.lang.Object executeQuery(DatabaseQuery query)
                              throws TopLinkException
Execute the database query. A query is a database operation such as reading or writting. The query allows for the operation to be customized for such things as, performance, depth, caching, etc.

Throws:
TopLinkException
See Also:
DatabaseQuery

executeQuery

java.lang.Object executeQuery(DatabaseQuery query,
                              java.util.Vector argumentValues)
Return the results from exeucting the database query. the arguments are passed in as a vector


executeSelectingCall

java.util.Vector executeSelectingCall(Call call)
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:
executeNonSelectingCall(Call)

executeSQL

java.util.Vector executeSQL(java.lang.String sqlString)
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()
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()
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

ClassDescriptor getClassDescriptor(java.lang.Class theClass)
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 hashtable, that descriptor will be stored under the new class.


getClassDescriptor

ClassDescriptor getClassDescriptor(java.lang.Object domainObject)
ADVANCED: Return the descriptor specified for the object's class.


getClassDescriptorForAlias

ClassDescriptor getClassDescriptorForAlias(java.lang.String alias)
Return the descriptor for the alias.


getAllFromIdentityMap

java.util.Vector getAllFromIdentityMap(Expression selectionCriteria,
                       java.lang.Class theClass,
                       Record translationRow,
                       InMemoryQueryIndirectionPolicy valueHolderPolicy)
                                       throws QueryException
Deprecated. 

ADVANCED: Query the cache in-memory. If the expression is too complex an exception will be thrown.

Throws:
QueryException
See Also:
getIdentityMapAccessor(), IdentityMapAccessor

getAllFromIdentityMap

java.util.Vector getAllFromIdentityMap(Expression selectionCriteria,
                       java.lang.Class theClass,
                       Record translationRow)
                                       throws QueryException
Deprecated. 

ADVANCED: Query the cache in-memory. If the expression is too complex an exception will be thrown.

Throws:
QueryException
See Also:
getIdentityMapAccessor(), IdentityMapAccessor

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:
acquireHistoricalSession(oracle.toplink.history.AsOfClause)

getCacheSynchronizationManager

CacheSynchronizationManager getCacheSynchronizationManager()
Deprecated. since OracleAS TopLink 10g (10.1.3). This method is replaced by DatabaseSession.getCommandManager()

ADVANCED: Returns the Synchronization Policy for this session.


getDescriptor

ClassDescriptor getDescriptor(java.lang.Class theClass)
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 hashtable, that descriptor will be stored under the new class.


getDescriptor

ClassDescriptor getDescriptor(java.lang.Object domainObject)
ADVANCED: Return the descriptor specified for the object's class.


getDescriptorForAlias

ClassDescriptor getDescriptorForAlias(java.lang.String alias)
Return the descriptor for the alias. UnitOfWork delegates this to the parent


getDescriptors

java.util.Map getDescriptors()
ADVANCED: Return all registered descriptors.


getEjbqlPlaceHolderQueries

java.util.List getEjbqlPlaceHolderQueries()
ADVANCED: Return all pre-defined not yet parsed EJBQL queries.

See Also:
#getAllQueries()

getEventManager

SessionEventManager getEventManager()
Return the event manager. The event manager can be used to register for various session events.


getExceptionHandler

ExceptionHandler getExceptionHandler()
Return the ExceptionHandler.Exception handler can catch errors that occur on queries or during database access.


getExternalTransactionController

ExternalTransactionController getExternalTransactionController()
Used for JTS integration. If your application requires to have JTS control transactions instead of TopLink an external transaction controler must be specified. TopLink provides JTS controlers for JTS 1.0 and Weblogic's JTS.

See Also:
JTATransactionController

getFromIdentityMap

java.lang.Object getFromIdentityMap(java.lang.Object domainObject)
Deprecated. 

ADVANCED: Return the object from the identity with primary and class of the given object.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

getFromIdentityMap

java.lang.Object getFromIdentityMap(java.util.Vector primaryKey,
                                    java.lang.Class theClass)
Deprecated. 

ADVANCED: Return the object from the identity with the primary and class.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

getFromIdentityMap

java.lang.Object getFromIdentityMap(Expression selectionCriteria,
                                    java.lang.Class theClass,
                                    Record translationRow)
                                    throws QueryException
Deprecated. Since 3.6.3

ADVANCED: Query the cache in-memory. If the object is not found null is returned. If the expression is too complex an exception will be thrown.

Throws:
QueryException
See Also:
getIdentityMapAccessor(), IdentityMapAccessor

getFromIdentityMap

java.lang.Object getFromIdentityMap(Expression selectionCriteria,
                                    java.lang.Class theClass,
                                    Record translationRow,
                                    InMemoryQueryIndirectionPolicy valueHolderPolicy)
                                    throws QueryException
Deprecated. 

ADVANCED: Query the cache in-memory. If the object is not found null is returned. If the expression is too complex an exception will be thrown.

Throws:
QueryException
See Also:
getIdentityMapAccessor(), IdentityMapAccessor

getIdentityMapAccessor

IdentityMapAccessor getIdentityMapAccessor()
The IdentityMapAccessor is the preferred way of accessing IdentityMap funcitons This will return an object which implements an interface which exposes all public IdentityMap functions.


getIntegrityChecker

IntegrityChecker getIntegrityChecker()
Returns the integrityChecker,the integrityChecker holds all the ClassDescriptor Exceptions.


getLog

java.io.Writer getLog()
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:
logMessages()

getPlatform

DatabasePlatform getPlatform()
Return the database platform currently connected to. The platform is used for database specific behavoir. NOTE: this must only be used for relational specific usage, it will fail for non-relational datasources.


getDatasourcePlatform

oracle.toplink.internal.databaseaccess.Platform getDatasourcePlatform()
Return the database platform currently connected to. The platform is used for database specific behavoir.


getLogin

DatabaseLogin getLogin()
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()
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.


getName

java.lang.String getName()
Return the name of the session. This is used with the session broker, or to give the session a more meaningful name.


getNextSequenceNumberValue

java.lang.Number getNextSequenceNumberValue(java.lang.Class domainClass)
ADVANCED: Return the sequnce number from the database


getProfiler

SessionProfiler getProfiler()
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()
Return the project. The project includes the login and descriptor and other configuration information.


getProperties

java.util.Map getProperties()
ADVANCED: Allow for user defined properties.


getProperty

java.lang.Object getProperty(java.lang.String name)
ADVANCED: Returns the user defined property.


getQueries

java.util.Map getQueries()
ADVANCED: Return all pre-defined queries.


getQuery

DatabaseQuery getQuery(java.lang.String name)
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

DatabaseQuery getQuery(java.lang.String name,
                       java.util.Vector arguments)
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()
Return the server platform currently used. The server platform is used for application server specific behavior.


getSessionLog

SessionLog getSessionLog()
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:
logMessages()

getWriteLockValue

java.lang.Object getWriteLockValue(java.lang.Object domainObject)
Deprecated. 

ADVANCED: Extract the write lock value from the identity map.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

getWriteLockValue

java.lang.Object getWriteLockValue(java.util.Vector primaryKey,
                                   java.lang.Class theClass)
Deprecated. 

ADVANCED: Extract the write lock value from the identity map.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

handleException

java.lang.Object handleException(java.lang.RuntimeException exception)
                                 throws java.lang.RuntimeException
Allow any WARNING level exceptions that occur within TopLink to be logged and handled by the exception handler.

Throws:
java.lang.RuntimeException

hasCacheSynchronizationManager

boolean hasCacheSynchronizationManager()
ADVANCED: Return true if a synchronisation policy exists


hasDescriptor

boolean hasDescriptor(java.lang.Class theClass)
ADVANCED: Return true if a descriptor exists for the given class.


hasExceptionHandler

boolean hasExceptionHandler()
Return if an exception handler is present.


hasExternalTransactionController

boolean hasExternalTransactionController()
Used for JTS integration. If your application requires to have JTS control transactions instead of TopLink an external transaction controler must be specified. TopLink provides JTS controlers for JTS 1.0 and Weblogic's JTS.

See Also:
JTATransactionController

initializeAllIdentityMaps

void initializeAllIdentityMaps()
Deprecated. 

Reset the entire object cache.

NOTE: be careful using this method. This method blows away both this session's and its parents caches, this includes the server cache or any other cache. This throws away any objects that have been read in. Extream caution should be used before doing this because object identity will no longer be maintained for any objects currently read in. This should only be called if the application knows that it no longer has references to object held in the cache.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

initializeIdentityMap

void initializeIdentityMap(java.lang.Class theClass)
Deprecated. 

Reset the identity map for only the instances of the class. For inheritence the user must make sure that they only use the root class. Caution must be used in doing this to ensure that the objects within the identity map are not referenced from other objects of other classes or from the application.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

initializeIdentityMaps

void initializeIdentityMaps()
Deprecated. 

Reset the entire object cache. This throws away any objects that have been read in. Extream caution should be used before doing this because object identity will no longer be maintained for any objects currently read in. This should only be called if the application knows that it no longer has references to object held in the cache.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

isClientSession

boolean isClientSession()
Return if this session is a client session.


isConnected

boolean isConnected()
Return if this session is connected to the database.


isDatabaseSession

boolean isDatabaseSession()
Return if this session is a database session.


isDistributedSession

boolean isDistributedSession()
Return if this session is a distributed session.


isInProfile

boolean isInProfile()
Return if a profiler is being used.


isRemoteSession

boolean isRemoteSession()
Return if this session is a remote session.


isServerSession

boolean isServerSession()
Return if this session is a server session.


isSessionBroker

boolean isSessionBroker()
Return if this session is a session broker.


isUnitOfWork

boolean isUnitOfWork()
Return if this session is a unit of work.


isRemoteUnitOfWork

boolean isRemoteUnitOfWork()
Return if this session is a remote unit of work.


keyFromObject

java.util.Vector keyFromObject(java.lang.Object domainObject)
                               throws ValidationException
ADVANCED: Extract and return the primary key from the object.

Throws:
ValidationException

log

void log(SessionLogEntry entry)
Log the log entry.


log

void log(SessionLogEntry entry)
Deprecated. Replaced by log(oracle.toplink.logging.SessionLogEntry)

OBSOLETE:

See Also:
log(oracle.toplink.logging.SessionLogEntry)

logDebug

void logDebug(java.lang.String message,
              java.lang.Object[] arguments)
Deprecated. No direct replacement, moved to internal AbstractSession.

OBSOLETE:

See Also:
logMessage(String)

logDebug

void logDebug(java.lang.String message)
Deprecated. No direct replacement, moved to internal AbstractSession.

OBSOLETE:

See Also:
logMessage(String)

logException

void logException(java.lang.Exception exception)
Deprecated. No direct replacement, moved to internal AbstractSession.

OBSOLETE:


logMessage

void logMessage(java.lang.String message,
                java.lang.Object[] arguments)
Deprecated. Replaced by log(int level, String category, String message, Object[] params)

OBSOLETE:

See Also:
logMessage(String)

logMessage

void logMessage(java.lang.String message)
Log a untranslated message to the TopLink log at FINER level.


logMessages

void logMessages()
Deprecated. Replaced by setLogLevel(int level, String category);

OBSOLETE:

See Also:
setLogLevel(int level)

printIdentityMap

void printIdentityMap(java.lang.Class businessClass)
Deprecated. 

Used to print all the objects in the identity map of the passed in class. The output of this method will be logged to this session's SessionLog at SEVERE level.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

printIdentityMaps

void printIdentityMaps()
Deprecated. 

Used to print all the objects in every identity map in this session. The output of this method will be logged to this session's SessionLog at SEVERE level.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

putInIdentityMap

java.lang.Object putInIdentityMap(java.lang.Object domainObject)
Deprecated. 

ADVANCED: Register the object with the identity map. The object must always be registered with its version number if optimistic locking is used.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

putInIdentityMap

java.lang.Object putInIdentityMap(java.lang.Object domainObject,
                                  java.util.Vector key)
Deprecated. 

ADVANCED: Register the object with the identity map. The object must always be registered with its version number if optimistic locking is used.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

putInIdentityMap

java.lang.Object putInIdentityMap(java.lang.Object domainObject,
                                  java.util.Vector key,
                                  java.lang.Object writeLockValue)
Deprecated. 

ADVANCED: Register the object with the identity map. The object must always be registered with its version number if optimistic locking is used.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

readAllObjects

java.util.Vector readAllObjects(java.lang.Class domainClass)
                                throws DatabaseException
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:
ReadAllQuery, readAllObjects(Class, Expression)

readAllObjects

java.util.Vector readAllObjects(java.lang.Class domainClass,
                java.lang.String sqlString)
                                throws DatabaseException
Deprecated. Replaced by readAllObjects(Class, Call)

OBSOLETE: Read all of the instances of the class from the database returned through execution the SQL string. The SQL string must be a valid SQL select statement or selecting stored procedure call. This operation can be customized through using a ReadAllQuery. Warning: Allowing an unverified SQL string to be passed into this method makes your application vulnerable to SQL injection attacks.

Throws:
DatabaseException

readAllObjects

java.util.Vector readAllObjects(java.lang.Class domainClass,
                Call aCall)
                                throws DatabaseException
Read all the instances of the class from the database returned through execution the Call string. The Call can be an SQLCall or EJBQLCall. example: session.readAllObjects(Employee.class, new SQLCall("SELECT * FROM EMPLOYEE"));

Throws:
DatabaseException
See Also:
SQLCall, EJBQLCall

readAllObjects

java.util.Vector readAllObjects(java.lang.Class domainClass,
                Expression selectionCriteria)
                                throws DatabaseException
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:
ReadAllQuery

readObject

java.lang.Object readObject(java.lang.Class domainClass)
                            throws DatabaseException
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 whish to consider a readObject method that takes selection criteria, such as: readObject(Class, Call), readObject(Class, Expression), or readObject(Object).

Throws:
DatabaseException
See Also:
ReadObjectQuery, readAllObjects(Class, Expression)

readObject

java.lang.Object readObject(java.lang.Class domainClass,
                            java.lang.String sqlString)
                            throws DatabaseException
Deprecated. use readObject(Class domainClass, Call aCall)

OBSOLETE: Read the first instance of the class from the database returned through execution the SQL string. The SQL string must be a valid SQL select statement or selecting stored procedure call. This operation can be customized through using a ReadObjectQuery. Warning: Allowing an unverified SQL string to be passed into this method makes your application vulnerable to SQL injection attacks.

Throws:
DatabaseException
See Also:
ReadObjectQuery

readObject

java.lang.Object readObject(java.lang.Class domainClass,
                            Call aCall)
                            throws DatabaseException
Read the first instance of the class from the database returned through execution the Call string. The Call can be an SQLCall or EJBQLCall. example: session.readObject(Employee.class, new SQLCall("SELECT * FROM EMPLOYEE"));

Throws:
DatabaseException
See Also:
SQLCall, EJBQLCall

readObject

java.lang.Object readObject(java.lang.Class domainClass,
                            Expression selectionCriteria)
                            throws DatabaseException
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:
ReadObjectQuery

readObject

java.lang.Object readObject(java.lang.Object object)
                            throws DatabaseException
Use the example object to consruct 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

java.lang.Object refreshObject(java.lang.Object object)
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 un commited changes to the object.


release

void release()
Release the session. This does nothing by default, but allows for other sessions such as the ClientSession to do something.


removeFromIdentityMap

void removeFromIdentityMap(java.lang.Object domainObject)
Deprecated. 

ADVANCED: Remove the object from the object cache. Caution should be used when calling to avoid violating object identity. The application should only call this is it knows that no references to the object exist.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

removeFromIdentityMap

void removeFromIdentityMap(java.util.Vector key,
                           java.lang.Class theClass)
Deprecated. 

ADVANCED: Remove the object from the object cache.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

removeProperty

void removeProperty(java.lang.String property)
Remove the user defined property.


removeQuery

void removeQuery(java.lang.String queryName)
Remove the query name from the set of pre-defined queries


setCacheSynchronizationManager

void setCacheSynchronizationManager(CacheSynchronizationManager synchronizationManager)
Deprecated. since OracleAS TopLink 10g (10.1.3). This method is replaced by DatabaseSession.setCommandManager(CommandManager)

ADVANCED: Sets synchronization policy for this session.


setExceptionHandler

void setExceptionHandler(ExceptionHandler exceptionHandler)
Set the exceptionHandler. Exception handler can catch errors that occur on queries or during database access.


setExternalTransactionController

void setExternalTransactionController(ExternalTransactionController externalTransactionController)
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:
oracle.toplink.platform.server.CustomServerPlatform

setIntegrityChecker

void setIntegrityChecker(IntegrityChecker integrityChecker)
Set the integrityChecker, the integrityChecker holds all the ClassDescriptor Exceptions.


setLog

void setLog(java.io.Writer log)
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:
logMessages()

setName

void setName(java.lang.String name)
Set the name of the session. This is used with the session broker, or to give the session a more meaningful name.


setProfiler

void setProfiler(SessionProfiler profiler)
Set the profiler for the session. This allows for performance operations to be profiled.


setProperty

void setProperty(java.lang.String propertyName,
                 java.lang.Object propertyValue)
Allow for user defined properties.


setSessionLog

void setSessionLog(SessionLog sessionLog)
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:
logMessages()

setSessionLog

void setSessionLog(SessionLog sessionLog)
Deprecated. 

OBSOLETE: Replaced by setSessionLog(oracle.toplink.logging.SessionLog);

See Also:
setSessionLog(oracle.toplink.logging.SessionLog)

setShouldLogMessages

void setShouldLogMessages(boolean shouldLogMessages)
Deprecated. 

OBSOLETE: Replaced by setLogLevel(int level, String category);

See Also:
setLogLevel(int)

shouldLogMessages

boolean shouldLogMessages()
Return if logging is enabled (false if log level is OFF)


updateWriteLockValue

void updateWriteLockValue(java.lang.Object domainObject,
                          java.lang.Object writeLockValue)
Deprecated. 

ADVANCED: Update the write lock value in the identity map.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

updateWriteLockValue

void updateWriteLockValue(java.util.Vector primaryKey,
                          java.lang.Class theClass,
                          java.lang.Object writeLockValue)
Deprecated. 

ADVANCED: Update the write lock value in the identity map.

See Also:
getIdentityMapAccessor(), IdentityMapAccessor

usesExternalTransactionController

boolean usesExternalTransactionController()
Deprecated. replaced by #hasExternalTransactionController()

OBSOLETE: This should no longer be used.


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

int getLogLevel(java.lang.String category)
Return the log level.
Possible values for log level and category are listed in SessionLog.

See Also:
SessionLog

getLogLevel

int getLogLevel()
Return the log level.
Possible values for log level are listed in SessionLog.

See Also:
SessionLog

setLogLevel

void setLogLevel(int level)
Set the log level.
Possible values for log level are listed in SessionLog.

See Also:
SessionLog

shouldLog

boolean shouldLog(int Level,
                  java.lang.String category)
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:
SessionLog

handleSevere

java.lang.Object handleSevere(java.lang.RuntimeException exception)
                              throws java.lang.RuntimeException
Allow any SEVERE level exceptions that occur within TopLink to be logged and handled by the exception handler.

Throws:
java.lang.RuntimeException

isFinalizersEnabled

boolean isFinalizersEnabled()
Return if this session's decendants should use finalizers. The allows certain finalizers such as in ClientSesion to be enabled. These are disable by default for performance reasons.


setIsFinalizersEnabled

void setIsFinalizersEnabled(boolean isFinalizersEnabled)
Set if this session's decendants should use finalizers. The allows certain finalizers such as in ClientSesion to be enabled. These are disable by default for performance reasons.


Copyright © 1998, 2010, Oracle. All Rights Reserved.