public abstract class AbstractSession extends java.lang.Object implements Session, java.io.Serializable, java.lang.Cloneable
Purpose: Define the interface and common protocol of a TopLink compliant session.
Description: The session is the primary interface into TopLink,
the application should do all of its reading and writing of objects through the session.
The session also manages transactions and units of work. Normally the session
is passed and used by the application controler objects. Controler objects normally
sit behind the GUI and perform the buiness processes required for the application,
they should perform all explict database access and database access should be avoided from
the domain object model. Do not use a globally accessable session instance, doing so does
not allow for multiple sessions. Multiple sessions may required when performing things like
data migration or multiple database access, as well the unit of work feature requires the usage
of multiple session instances. Although session is abstract, any users of its subclasses
should only cast the variables to Session to allow usage of any of its subclasses.
Responsibilities:
- Connecting/disconnecting.
- Reading and writing objects.
- Transaction and unit of work support.
- Identity maps and caching.
,
DatabaseSession
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected Accessor |
accessor
The connection to the data store.
|
protected AbstractSession |
broker
Support being owned by a session broker.
|
protected CommitManager |
commitManager
Resolves referencial integrity on commits.
|
protected java.util.List |
ejbqlPlaceHolderQueries
Stores predefined not yet parsed EJBQL queries.
|
protected SessionEventManager |
eventManager
Stores the event listeners for this session.
|
protected ExceptionHandler |
exceptionHandler
ExceptionHandler handles database exceptions.
|
protected ExternalTransactionController |
externalTransactionController
Delegate that handles synchronizing a UnitOfWork with an external transaction.
|
protected IdentityMapAccessor |
identityMapAccessor
Manages the live object cache.
|
protected IntegrityChecker |
integrityChecker
IntegrityChecker catch all the descriptor Exceptions.
|
boolean |
isInProfile
Used to determine If a session is in a profile or not
|
protected ClassDescriptor |
lastDescriptorAccessed
Last descriptor accessed, use to optimize descriptor lookup.
|
protected java.lang.String |
logSessionString
When logging the name of the session is typed: class name + system hashcode.
|
protected java.lang.String |
name
Used to identify a session when using the session broker.
|
protected int |
numberOfActiveUnitsOfWork
Keep track of active units of work.
|
protected Platform |
platform
Allow the datasource platform to be cached.
|
protected SessionProfiler |
profiler
Tool that log performance information.
|
protected Project |
project
The project stores configuration information, such as the descriptors and login.
|
protected java.util.Map |
properties
Allow for user defined properties.
|
protected java.util.Map |
queries
Stores predefine reusable queries.
|
protected SessionLog |
sessionLog
Destination for logged messages and SQL.
|
protected ConcurrencyManager |
transactionMutex
Ensure mutual exclusion of the session's transaction state across multiple threads.
|
protected boolean |
wasJTSTransactionInternallyStarted
If Transactions were externally started
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractSession()
INTERNAL:
Create and return a new session.
|
protected |
AbstractSession(int nothing)
INTERNAL:
Create a blank session, used for proxy session.
|
|
AbstractSession(Login login)
PUBLIC:
Create and return a new session.
|
|
AbstractSession(Project project)
PUBLIC:
Create and return a new session.
|
Modifier and Type | Method and Description |
---|---|
UnitOfWorkImpl |
acquireNonSynchronizedUnitOfWork()
INTERNAL:
Return a unit of work for this session not registered with the JTS transaction.
|
UnitOfWork |
acquireUnitOfWork()
PUBLIC:
Return a unit of work for this session.
|
void |
addAlias(java.lang.String alias,
ClassDescriptor descriptor)
PUBLIC:
Add an alias for the descriptor
|
void |
addEjbqlPlaceHolderQuery(DatabaseQuery query)
INTERNAL:
Return all pre-defined not yet parsed EJBQL queries.
|
protected void |
addQuery(DatabaseQuery query)
INTERNAL:
Add the query to the session queries.
|
void |
addQuery(java.lang.String name,
DatabaseQuery query)
PUBLIC:
Add the query to the session queries with the given name.
|
void |
afterTransaction(boolean committed,
boolean isExternalTransaction)
INTERNAL:
Called after transaction is completed (committed or rolled back)
|
protected void |
basicBeginTransaction()
INTERNAL:
Called by beginTransaction() to start a transaction.
|
protected void |
basicCommitTransaction()
INTERNAL:
Called by commitTransaction() to commit a transaction.
|
protected void |
basicRollbackTransaction()
INTERNAL:
Called by rollbackTransaction() to rollback a transaction.
|
boolean |
beginExternalTransaction()
INTERNAL:
Attempts to begin an external transaction.
|
void |
beginTransaction()
PUBLIC:
Begin a transaction on the database.
|
void |
clearIntegrityChecker()
PUBLIC:
clear the integrityChecker.
|
void |
clearLastDescriptorAccessed()
INTERNAL:
clear the lastDescriptorAccessed.
|
void |
clearProfile()
PUBLIC:
Clear the profiler, this will end the current profile opperation.
|
java.lang.Object |
clone()
INTERNAL:
Clones the descriptor
|
boolean |
commitExternalTransaction()
INTERNAL:
Attempts to commit the running internally started external transaction.
|
void |
commitTransaction()
PUBLIC:
Commit the active database transaction.
|
boolean |
compareObjects(java.lang.Object firstObject,
java.lang.Object secondObject)
INTERNAL:
Return if the two object match completely.
|
boolean |
compareObjectsDontMatch(java.lang.Object firstObject,
java.lang.Object secondObject)
TESTING:
Return true if the object do not match.
|
void |
config(java.lang.String message,
java.lang.String category)
PUBLIC:
|
boolean |
containsQuery(java.lang.String queryName)
PUBLIC:
Return true if the pre-defined query is defined on the session.
|
java.lang.Object |
copyObject(java.lang.Object original)
PUBLIC:
Return a complete copy of the object.
|
java.lang.Object |
copyObject(java.lang.Object original,
ObjectCopyingPolicy policy)
PUBLIC:
Return a complete copy of the object.
|
java.util.Vector |
copyReadOnlyClasses()
INTERNAL:
Copy the read only classes from the unit of work
Added Nov 8, 2000 JED for Patch 2.5.1.8
Ref: Prs 24502
|
void |
deleteAllObjects(java.util.Collection domainObjects)
PUBLIC:
delete all of the objects and all of their privately owned parts in the database.
|
void |
deleteAllObjects(java.util.Vector domainObjects)
PUBLIC:
delete all of the objects and all of their privately owned parts in the database.
|
java.lang.Object |
deleteObject(java.lang.Object domainObject)
PUBLIC:
Delete the object and all of its privately owned parts from the database.
|
boolean |
doesObjectExist(java.lang.Object object)
PUBLIC:
Return if the object exists on the database or not.
|
void |
dontLogMessages()
PUBLIC:
Turn off logging
|
void |
endOperationProfile(java.lang.String operationName)
INTERNAL:
End the operation timing.
|
java.lang.Object |
executeCall(Call call,
AbstractRecord translationRow,
DatabaseQuery query)
INTERNAL:
Overridden by subclasses that do more than just execute the call.
|
int |
executeNonSelectingCall(Call call)
PUBLIC:
Execute the call on the database.
|
void |
executeNonSelectingSQL(java.lang.String sqlString)
PUBLIC:
Execute the sql on the database.
|
java.lang.Object |
executeQuery(DatabaseQuery query)
PUBLIC:
Execute the database query.
|
java.lang.Object |
executeQuery(DatabaseQuery query,
AbstractRecord row)
INTERNAL:
Return the results from exeucting the database query.
|
java.lang.Object |
executeQuery(DatabaseQuery query,
java.util.Vector argumentValues)
PUBLIC:
Return the results from exeucting the database query.
|
java.lang.Object |
executeQuery(java.lang.String queryName)
PUBLIC:
Execute the pre-defined query by name and return the result.
|
java.lang.Object |
executeQuery(java.lang.String queryName,
java.lang.Class domainClass)
PUBLIC:
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)
PUBLIC:
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)
PUBLIC:
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)
PUBLIC:
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)
PUBLIC:
Execute the pre-defined query by name and return the result.
|
java.lang.Object |
executeQuery(java.lang.String queryName,
java.lang.Object arg1)
PUBLIC:
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)
PUBLIC:
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)
PUBLIC:
Execute the pre-defined query by name and return the result.
|
java.lang.Object |
executeQuery(java.lang.String queryName,
java.util.Vector argumentValues)
PUBLIC:
Execute the pre-defined query by name and return the result.
|
java.util.Vector |
executeSelectingCall(Call call)
PUBLIC:
Execute the call on the database and return the result.
|
java.util.Vector |
executeSQL(java.lang.String sqlString)
PUBLIC:
Execute the sql on the database and return the result.
|
void |
fine(java.lang.String message,
java.lang.String category)
PUBLIC:
|
void |
finer(java.lang.String message,
java.lang.String category)
PUBLIC:
|
void |
finest(java.lang.String message,
java.lang.String category)
PUBLIC:
|
Accessor |
getAccessor()
INTERNAL:
Return the lowlevel database accessor.
|
Accessor |
getAccessor(java.lang.Class domainClass)
INTERNAL:
Return the lowlevel database accessor.
|
Accessor |
getAccessor(java.lang.String sessionName)
INTERNAL:
Return the lowlevel database accessor.
|
Session |
getActiveSession()
PUBLIC:
Return the active session for the current active external (JTS) transaction.
|
UnitOfWork |
getActiveUnitOfWork()
PUBLIC:
Return the active unit of work for the current active external (JTS) transaction.
|
java.util.Map |
getAliasDescriptors()
INTERNAL:
Returns the alias descriptors hashtable.
|
java.util.Vector |
getAllQueries()
PUBLIC:
Return the pre-defined queries in this session.
|
AbstractSession |
getBroker()
INTERNAL:
Allow the session to be used from a session broker.
|
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)
PUBLIC:
Return the descriptor for the alias.
|
CommitManager |
getCommitManager()
INTERNAL:
The commit manager is used to resolve referncial integrity on commits of multiple objects.
|
Login |
getDatasourceLogin()
PUBLIC:
Return the login, the login holds any database connection information given.
|
Platform |
getDatasourcePlatform()
PUBLIC:
Return the database platform currently connected to.
|
java.util.Vector |
getDefaultReadOnlyClasses()
INTERNAL:
Returns the set of read-only classes that gets assigned to each newly created UnitOfWork.
|
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)
PUBLIC:
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()
PUBLIC:
Return the event manager.
|
ExceptionHandler |
getExceptionHandler()
PUBLIC:
Return the ExceptionHandler.Exception handler can catch errors that occur on queries or during database access.
|
java.lang.String |
getExceptionHandlerClass()
INTERNAL:
Return a string which represents my ExceptionHandler's class
Added for F2104: Properties.xml
- gn
|
AbstractSession |
getExecutionSession(DatabaseQuery query)
INTERNAL:
Gets the session which this query will be executed on.
|
ExternalTransactionController |
getExternalTransactionController()
PUBLIC:
Used for JTS integration.
|
IdentityMapAccessor |
getIdentityMapAccessor()
PUBLIC:
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.
|
IdentityMapAccessor |
getIdentityMapAccessorInstance()
INTERNAL:
Return the internally available IdentityMapAccessor instance.
|
IntegrityChecker |
getIntegrityChecker()
PUBLIC:
Returns the integrityChecker.IntegrityChecker holds all the Descriptor Exceptions.
|
java.io.Writer |
getLog()
PUBLIC:
Return the writer to which an accessor writes logged messages and SQL.
|
DatabaseLogin |
getLogin()
INTERNAL:
Return the login, the login holds any database connection information given.
|
int |
getLogLevel()
PUBLIC:
|
int |
getLogLevel(java.lang.String category)
PUBLIC:
|
java.lang.String |
getLogSessionString()
INTERNAL:
Return the name of the session: class name + system hashcode.
|
java.lang.String |
getName()
PUBLIC:
Return the name of the session.
|
long |
getNextQueryId()
INTERNAL:
Called by a sessions queries to obtain individual query ids.
|
java.lang.Number |
getNextSequenceNumberValue(java.lang.Class domainClass)
ADVANCED:
Return the sequnce number from the database
|
int |
getNumberOfActiveUnitsOfWork()
INTERNAL:
Return the number of units of work connected.
|
AbstractSession |
getParentIdentityMapSession(DatabaseQuery query)
INTERNAL:
Gets the next link in the chain of sessions followed by a query's check
early return, the chain of sessions with identity maps all the way up to
the root session.
|
AbstractSession |
getParentIdentityMapSession(DatabaseQuery query,
boolean canReturnSelf,
boolean terminalOnly)
INTERNAL:
Gets the next link in the chain of sessions followed by a query's check
early return, the chain of sessions with identity maps all the way up to
the root session.
|
DatabasePlatform |
getPlatform()
PUBLIC:
Return the database platform currently connected to.
|
Platform |
getPlatform(java.lang.Class domainClass)
INTERNAL:
Return the database platform currently connected to
for specified class.
|
SessionProfiler |
getProfiler()
PUBLIC:
Return the profiler.
|
Project |
getProject()
PUBLIC:
Return the project, the project holds configuartion information including the descriptors.
|
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)
PUBLIC:
Return the query from the session pre-defined queries with the given name.
|
DatabaseQuery |
getQuery(java.lang.String name,
java.util.Vector arguments)
PUBLIC:
Return the query from the session pre-defined queries with the given name and argument types.
|
AbstractSession |
getRootSession(DatabaseQuery query)
INTERNAL:
The session that this query is executed against when not in transaction.
|
Sequencing |
getSequencing()
INTERNAL:
Return the Sequencing object used by the session.
|
ServerPlatform |
getServerPlatform()
INTERNAL:
Marked internal as this is not customer API but helper methods for
accessing the server platform from within TopLink's other sessions types
(ie not DatabaseSession)
|
AbstractSession |
getSessionForClass(java.lang.Class domainClass)
INTERNAL:
Return the session to be used for the class.
|
SessionLog |
getSessionLog()
PUBLIC:
Return the session log to which an accessor logs messages and SQL.
|
java.lang.String |
getSessionTypeString()
INTERNAL:
Returns the type of session, its class.
|
ConcurrencyManager |
getTransactionMutex()
INTERNAL:
The transaction mutex ensure mutual exclusion on transaction across multiple threads.
|
java.lang.Object |
handleException(java.lang.RuntimeException exception)
PUBLIC:
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)
PUBLIC:
Allow any SEVERE level exceptions that occur within TopLink to be logged and handled by the exception handler.
|
boolean |
hasBroker()
INTERNAL:
Allow the session to be used from a session broker.
|
boolean |
hasDescriptor(java.lang.Class theClass)
ADVANCED:
Return true if a descriptor exists for the given class.
|
boolean |
hasExceptionHandler()
PUBLIC:
Return if an exception handler is present.
|
boolean |
hasExternalTransactionController()
PUBLIC:
Used for JTA integration.
|
boolean |
hasProperties()
INTERNAL:
Allow to check for user defined properties.
|
void |
incrementProfile(java.lang.String operationName)
INTERNAL:
Updates the count of SessionProfiler event
|
void |
info(java.lang.String message,
java.lang.String category)
PUBLIC:
|
void |
initializeIdentityMapAccessor()
INTERNAL:
Set up the IdentityMapManager.
|
java.lang.Object |
insertObject(java.lang.Object domainObject)
PUBLIC:
Insert the object and all of its privately owned parts into the database.
|
java.lang.Object |
internalExecuteQuery(DatabaseQuery query,
AbstractRecord databaseRow)
INTERNAL:
Return the results from exeucting the database query.
|
boolean |
isBroker()
INTERNAL:
Returns true if the session is a session Broker.
|
boolean |
isClassReadOnly(java.lang.Class theClass)
PUBLIC:
Return if the class is defined as read-only.
|
boolean |
isClassReadOnly(java.lang.Class theClass,
ClassDescriptor descriptor)
INTERNAL:
Return if the class is defined as read-only.
|
boolean |
isClientSession()
PUBLIC:
Return if this session is a client session.
|
boolean |
isConnected()
PUBLIC:
Return if this session is connected to the database.
|
boolean |
isDatabaseSession()
PUBLIC:
Return if this session is a database session.
|
boolean |
isDistributedSession()
PUBLIC:
Return if this session is a distributed session.
|
boolean |
isInBroker()
INTERNAL:
Returns true if the session is in a session Broker.
|
boolean |
isInProfile()
PUBLIC:
Return if a profiler is being used.
|
boolean |
isInTransaction()
PUBLIC:
Return if the session is currently in the progress of a database transaction.
|
boolean |
isRemoteSession()
PUBLIC:
Return if this session is remote.
|
boolean |
isRemoteUnitOfWork()
PUBLIC:
Return if this session is a unit of work.
|
boolean |
isServerSession()
PUBLIC:
Return if this session is a server session.
|
boolean |
isSessionBroker()
PUBLIC:
Return if this session is a session broker.
|
boolean |
isUnitOfWork()
PUBLIC:
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.
|
java.util.Vector |
keyFromObject(java.lang.Object domainObject,
ClassDescriptor descriptor)
ADVANCED:
Extract and return the primary key from the object.
|
void |
log(int level,
java.lang.String message,
java.lang.Object[] params,
Accessor accessor)
INTERNAL:
|
void |
log(int level,
java.lang.String message,
java.lang.Object[] params,
Accessor accessor,
boolean shouldTranslate)
INTERNAL:
|
void |
log(int level,
java.lang.String category,
java.lang.String message)
PUBLIC:
|
void |
log(int level,
java.lang.String category,
java.lang.String message,
java.lang.Object param)
INTERNAL:
|
void |
log(int level,
java.lang.String category,
java.lang.String message,
java.lang.Object[] params)
INTERNAL:
|
void |
log(int level,
java.lang.String category,
java.lang.String message,
java.lang.Object[] params,
Accessor accessor)
INTERNAL:
|
void |
log(int level,
java.lang.String category,
java.lang.String message,
java.lang.Object[] params,
Accessor accessor,
boolean shouldTranslate)
INTERNAL:
|
void |
log(int level,
java.lang.String category,
java.lang.String message,
java.lang.Object param1,
java.lang.Object param2)
INTERNAL:
|
void |
log(int level,
java.lang.String category,
java.lang.String message,
java.lang.Object param1,
java.lang.Object param2,
java.lang.Object param3)
INTERNAL:
|
void |
log(SessionLogEntry entry)
PUBLIC:
Log the log entry.
|
void |
logMessage(java.lang.String message)
Log a untranslated message to the TopLink log at FINER level.
|
void |
logThrowable(int level,
java.lang.String category,
java.lang.Throwable throwable)
PUBLIC:
|
DatabaseQuery |
prepareDatabaseQuery(DatabaseQuery query)
INTERNAL:
A call back to do session specific preparation of a query.
|
void |
processEJBQLQueries()
INTERNAL:
Allows for EJBQL strings to be parsed and added as named queries.
|
void |
processEJBQLQueries(java.util.List queries)
INTERNAL:
Allows for EJBQL strings to be parsed and added as named queries.
|
java.util.Vector |
readAllObjects(java.lang.Class domainClass)
PUBLIC:
Read all of the instances of the class from the database.
|
java.util.Vector |
readAllObjects(java.lang.Class referenceClass,
Call aCall)
PUBLIC:
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 expression)
PUBLIC:
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)
PUBLIC:
Read all of the instances of the class from the database return through execution the SQL string.
|
java.lang.Object |
readObject(java.lang.Class domainClass)
PUBLIC:
Read the first instance of the class from the database.
|
java.lang.Object |
readObject(java.lang.Class domainClass,
Call aCall)
PUBLIC:
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 expression)
PUBLIC:
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)
PUBLIC:
Read the first instance of the class from the database return through execution the SQL string.
|
java.lang.Object |
readObject(java.lang.Object object)
PUBLIC:
Use the example object to consruct a read object query by the objects primary key.
|
java.lang.Object |
refreshAndLockObject(java.lang.Object object)
PUBLIC:
Refresh the attributes of the object and of all of its private parts from the database.
|
java.lang.Object |
refreshAndLockObject(java.lang.Object object,
short lockMode)
PUBLIC:
Refresh the attributes of the object and of all of its private parts from the database.
|
java.lang.Object |
refreshObject(java.lang.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 |
releaseUnitOfWork(UnitOfWorkImpl unitOfWork)
INTERNAL:
Release the unit of work, if lazy release the connection.
|
void |
removeProperty(java.lang.String property)
PUBLIC:
Remove the user defined property.
|
void |
removeQuery(java.lang.String queryName)
PUBLIC:
Remove all queries with the given queryName regardless of the argument types.
|
void |
removeQuery(java.lang.String queryName,
java.util.Vector argumentTypes)
PUBLIC:
Remove the specific query with the given queryName and argumentTypes.
|
protected boolean |
rollbackExternalTransaction()
PROTECTED:
Attempts to rollback the running internally started external transaction.
|
void |
rollbackTransaction()
PUBLIC:
Rollback the active database transaction.
|
void |
setAccessor(Accessor accessor)
INTERNAL:
Set the accessor.
|
void |
setBroker(AbstractSession broker)
INTERNAL:
Allow the session to be used from a session broker.
|
void |
setCommitManager(CommitManager commitManager)
INTERNAL:
The commit manager is used to resolve referncial integrity on commits of multiple objects.
|
void |
setDatasourceLogin(Login login)
PUBLIC:
Set the login.
|
void |
setEventManager(SessionEventManager eventManager)
INTERNAL:
Set the event manager.
|
void |
setExceptionHandler(ExceptionHandler exceptionHandler)
PUBLIC:
Set the exceptionHandler.
|
void |
setExternalTransactionController(ExternalTransactionController externalTransactionController)
Used for JTS integration internally by ServerPlatform.
|
void |
setIntegrityChecker(IntegrityChecker integrityChecker)
PUBLIC:
set the integrityChecker.
|
void |
setIsInProfile(boolean inProfile)
PUBLIC:
Allow for user deactive a profiler
|
void |
setLog(java.io.Writer log)
PUBLIC:
Set the writer to which an accessor writes logged messages and SQL.
|
void |
setLogin(DatabaseLogin login)
PUBLIC:
Set the login.
|
void |
setLogin(Login login)
PUBLIC:
Set the login.
|
void |
setLogLevel(int level)
PUBLIC:
|
void |
setName(java.lang.String name)
PUBLIC:
Set the name of the session.
|
protected void |
setNumberOfActiveUnitsOfWork(int numberOfActiveUnitsOfWork) |
void |
setProfiler(SessionProfiler profiler)
PUBLIC:
Set the profiler for the session.
|
void |
setProject(Project project)
INTERNAL:
Set the project, the project holds configuartion information including the descriptors.
|
void |
setProperties(java.util.Hashtable properties)
INTERNAL:
Set the user defined properties.
|
void |
setProperty(java.lang.String propertyName,
java.lang.Object propertyValue)
PUBLIC:
Allow for user defined properties.
|
protected void |
setQueries(java.util.Hashtable queries) |
void |
setSessionLog(SessionLog sessionLog)
PUBLIC:
Set the session log to which an accessor logs messages and SQL.
|
protected void |
setTransactionMutex(ConcurrencyManager transactionMutex) |
void |
setWasJTSTransactionInternallyStarted(boolean wasJTSTransactionInternallyStarted)
INTERNAL:
Return if a JTS transaction was started by the session.
|
void |
severe(java.lang.String message,
java.lang.String category)
PUBLIC:
|
boolean |
shouldLog(int Level,
java.lang.String category)
PUBLIC:
|
boolean |
shouldLogMessages()
PUBLIC:
Return if logging is enabled (false if log level is OFF)
|
void |
startOperationProfile(java.lang.String operationName)
INTERNAL:
Start the operation timing.
|
java.lang.String |
toString()
Print the connection status with the session.
|
java.lang.Object |
unwrapObject(java.lang.Object proxy)
INTERNAL:
Unwrap the object if required.
|
java.lang.Object |
updateObject(java.lang.Object domainObject)
PUBLIC:
Update the object and all of its privately owned parts in the database.
|
void |
updateProfile(java.lang.String operationName,
java.lang.Object value)
INTERNAL:
Updates the value of SessionProfiler state
|
void |
validateQuery(DatabaseQuery query)
INTERNAL:
This method will be used to update the query with any settings required
For this session.
|
boolean |
verifyDelete(java.lang.Object domainObject)
TESTING:
This is used by testing code to ensure that a deletion was successful.
|
void |
warning(java.lang.String message,
java.lang.String category)
PUBLIC:
|
boolean |
wasJTSTransactionInternallyStarted()
INTERNAL:
Return if a JTS transaction was started by the session.
|
java.lang.Object |
wrapObject(java.lang.Object implementation)
INTERNAL:
Wrap the object if required.
|
protected void |
writeAllObjects(IdentityHashtable domainObjects)
INTERNAL:
Write all of the objects and all of their privately owned parts in the database.
|
protected void |
writeAllObjectsWithChangeSet(UnitOfWorkChangeSet uowChangeSet)
INTERNAL:
Write all of the objects and all of their privately owned parts in the database.
|
java.lang.Object |
writeObject(java.lang.Object domainObject)
PUBLIC:
Write the object and all of its privately owned parts in the database.
|
void |
writesCompleted()
INTERNAL:
This method notifies the accessor that a particular sets of writes has
completed.
|
protected transient ExceptionHandler exceptionHandler
protected transient IntegrityChecker integrityChecker
protected transient Project project
protected transient ConcurrencyManager transactionMutex
protected IdentityMapAccessor identityMapAccessor
protected boolean wasJTSTransactionInternallyStarted
protected transient Accessor accessor
protected transient Platform platform
protected transient java.util.Map queries
protected transient java.util.List ejbqlPlaceHolderQueries
protected transient CommitManager commitManager
protected transient SessionProfiler profiler
protected transient AbstractSession broker
protected java.lang.String name
protected transient int numberOfActiveUnitsOfWork
protected transient SessionLog sessionLog
protected transient java.lang.String logSessionString
protected transient SessionEventManager eventManager
protected java.util.Map properties
protected transient ExternalTransactionController externalTransactionController
protected transient ClassDescriptor lastDescriptorAccessed
public boolean isInProfile
protected AbstractSession()
protected AbstractSession(int nothing)
public AbstractSession(Login login)
public AbstractSession(Project project)
public long getNextQueryId()
public UnitOfWorkImpl acquireNonSynchronizedUnitOfWork()
public UnitOfWork acquireUnitOfWork()
acquireUnitOfWork
in interface Session
UnitOfWork
public void addAlias(java.lang.String alias, ClassDescriptor descriptor)
public void addQuery(java.lang.String name, DatabaseQuery query)
public void addEjbqlPlaceHolderQuery(DatabaseQuery query)
addEjbqlPlaceHolderQuery
in interface Session
getAllQueries()
protected void addQuery(DatabaseQuery query)
protected void basicBeginTransaction() throws DatabaseException
DatabaseException
public void afterTransaction(boolean committed, boolean isExternalTransaction)
protected void basicCommitTransaction() throws DatabaseException
DatabaseException
protected void basicRollbackTransaction() throws DatabaseException
DatabaseException
public boolean beginExternalTransaction()
public void beginTransaction() throws DatabaseException, ConcurrencyException
DatabaseException
- if the database connection is lost or the begin is rejected.ConcurrencyException
- if this session's transaction is aquired by another thread and a timeout occurs.isInTransaction()
public void clearIntegrityChecker()
clearIntegrityChecker
in interface Session
public void clearLastDescriptorAccessed()
public void clearProfile()
clearProfile
in interface Session
public java.lang.Object clone()
clone
in class java.lang.Object
public boolean commitExternalTransaction()
public void commitTransaction() throws DatabaseException, ConcurrencyException
DatabaseException
- most databases validate changes as they are done,
normally errors do not occur on commit unless the disk fails or the connection is lost.ConcurrencyException
- if this session is not within a transaction.public boolean compareObjects(java.lang.Object firstObject, java.lang.Object secondObject)
public boolean compareObjectsDontMatch(java.lang.Object firstObject, java.lang.Object secondObject)
public boolean containsQuery(java.lang.String queryName)
containsQuery
in interface Session
public java.lang.Object copyObject(java.lang.Object original)
copyObject
in interface Session
copyObject(Object, ObjectCopyingPolicy)
public java.lang.Object copyObject(java.lang.Object original, ObjectCopyingPolicy policy)
copyObject
in interface Session
public java.util.Vector copyReadOnlyClasses()
public void deleteAllObjects(java.util.Collection domainObjects) throws DatabaseException, OptimisticLockException
DatabaseException
- if an error occurs on the database,
these include constraint violations, security violations and general database erros.OptimisticLockException
- if the object's descriptor is using optimistic locking and
the object has been updated or deleted by another user since it was last read.public void deleteAllObjects(java.util.Vector domainObjects) throws DatabaseException, OptimisticLockException
DatabaseException
- if an error occurs on the database,
these include constraint violations, security violations and general database erros.OptimisticLockException
- if the object's descriptor is using optimistic locking and
the object has been updated or deleted by another user since it was last read.public java.lang.Object deleteObject(java.lang.Object domainObject) throws DatabaseException, OptimisticLockException
DatabaseException
- if an error occurs on the database,
these include constraint violations, security violations and general database erros.
An database error is not raised if the object is already deleted or no rows are effected.OptimisticLockException
- if the object's descriptor is using optimistic locking and
the object has been updated or deleted by another user since it was last read.DeleteObjectQuery
public boolean doesObjectExist(java.lang.Object object) throws DatabaseException
doesObjectExist
in interface Session
DatabaseException
public void dontLogMessages()
dontLogMessages
in interface Session
public void endOperationProfile(java.lang.String operationName)
public void updateProfile(java.lang.String operationName, java.lang.Object value)
public void incrementProfile(java.lang.String operationName)
public java.lang.Object executeCall(Call call, AbstractRecord translationRow, DatabaseQuery query) throws DatabaseException
DatabaseException
public int executeNonSelectingCall(Call call) throws DatabaseException
Example:
session.executeNonSelectingCall(new SQLCall("Delete from Employee");
executeNonSelectingCall
in interface Session
DatabaseException
executeSelectingCall(Call)
public void executeNonSelectingSQL(java.lang.String sqlString) throws DatabaseException
Example:
session.executeNonSelectingSQL("Delete from Employee");
executeNonSelectingSQL
in interface Session
DatabaseException
executeNonSelectingCall(Call)
public java.lang.Object executeQuery(java.lang.String queryName) throws DatabaseException
executeQuery
in interface Session
DatabaseException
addQuery(String, DatabaseQuery)
public java.lang.Object executeQuery(java.lang.String queryName, java.lang.Class domainClass) throws DatabaseException
executeQuery
in interface Session
DatabaseException
DescriptorQueryManager#addQuery(String, DatabaseQuery)
public java.lang.Object executeQuery(java.lang.String queryName, java.lang.Class domainClass, java.lang.Object arg1) throws DatabaseException
executeQuery
in interface Session
DatabaseException
DescriptorQueryManager#addQuery(String, DatabaseQuery)
public java.lang.Object executeQuery(java.lang.String queryName, java.lang.Class domainClass, java.lang.Object arg1, java.lang.Object arg2) throws DatabaseException
executeQuery
in interface Session
DatabaseException
DescriptorQueryManager#addQuery(String, DatabaseQuery)
public java.lang.Object executeQuery(java.lang.String queryName, java.lang.Class domainClass, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3) throws DatabaseException
executeQuery
in interface Session
DatabaseException
DescriptorQueryManager#addQuery(String, DatabaseQuery)
public java.lang.Object executeQuery(java.lang.String queryName, java.lang.Class domainClass, java.util.Vector argumentValues) throws DatabaseException
executeQuery
in interface Session
DatabaseException
DescriptorQueryManager#addQuery(String, DatabaseQuery)
public java.lang.Object executeQuery(java.lang.String queryName, java.lang.Object arg1) throws DatabaseException
executeQuery
in interface Session
DatabaseException
addQuery(String, DatabaseQuery)
public java.lang.Object executeQuery(java.lang.String queryName, java.lang.Object arg1, java.lang.Object arg2) throws DatabaseException
executeQuery
in interface Session
DatabaseException
addQuery(String, DatabaseQuery)
public java.lang.Object executeQuery(java.lang.String queryName, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3) throws DatabaseException
executeQuery
in interface Session
DatabaseException
addQuery(String, DatabaseQuery)
public java.lang.Object executeQuery(java.lang.String queryName, java.util.Vector argumentValues) throws DatabaseException
executeQuery
in interface Session
DatabaseException
addQuery(String, DatabaseQuery)
public java.lang.Object executeQuery(DatabaseQuery query) throws DatabaseException
executeQuery
in interface Session
DatabaseException
DatabaseQuery
public java.lang.Object executeQuery(DatabaseQuery query, java.util.Vector argumentValues) throws DatabaseException
executeQuery
in interface Session
DatabaseException
public java.lang.Object executeQuery(DatabaseQuery query, AbstractRecord row) throws DatabaseException
DatabaseException
public java.util.Vector executeSelectingCall(Call call) throws DatabaseException
Example:
session.executeSelectingCall(new SQLCall("Select * from Employee");
executeSelectingCall
in interface Session
DatabaseException
executeNonSelectingCall(Call)
public java.util.Vector executeSQL(java.lang.String sqlString) throws DatabaseException
Example:
session.executeSelectingCall("Select * from Employee");
executeSQL
in interface Session
DatabaseException
executeSelectingCall(Call)
public Accessor getAccessor()
public Accessor getAccessor(java.lang.Class domainClass)
public Accessor getAccessor(java.lang.String sessionName)
public Session getActiveSession()
getActiveSession
in interface Session
public UnitOfWork getActiveUnitOfWork()
getActiveUnitOfWork
in interface Session
public java.util.Map getAliasDescriptors()
public AbstractSession getBroker()
public AbstractSession getRootSession(DatabaseQuery query)
In most cases this is the root ServerSession or DatabaseSession.
In cases where objects are not to be cached in the global identity map an alternate session may be returned:
public AbstractSession getParentIdentityMapSession(DatabaseQuery query)
public AbstractSession getParentIdentityMapSession(DatabaseQuery query, boolean canReturnSelf, boolean terminalOnly)
Used for session broker which delegates to registered sessions, or UnitOfWork which checks parent identity map also.
canReturnSelf
- true when method calls itself. If the path
starting at this
is acceptable. Sometimes true if want to
move to the first valid session, i.e. executing on ClientSession when really
should be on ServerSession.terminalOnly
- return the session we will execute the call on, not
the next step towards it.public AbstractSession getExecutionSession(DatabaseQuery query)
Since the execution session also knows the correct datasource platform to execute on, it is often used in the mappings where the platform is needed for type conversion, or where calls are translated.
Is also the session with the accessor. Will return a ClientSession if it is in transaction and has a write connection.
query
- may store session name or reference class for brokers casepublic CommitManager getCommitManager()
public java.util.Vector getDefaultReadOnlyClasses()
public ClassDescriptor getClassDescriptor(java.lang.Class theClass)
getClassDescriptor
in interface Session
public ClassDescriptor getClassDescriptor(java.lang.Object domainObject)
getClassDescriptor
in interface Session
public ClassDescriptor getClassDescriptorForAlias(java.lang.String alias)
getClassDescriptorForAlias
in interface Session
public ClassDescriptor getDescriptor(java.lang.Class theClass)
getDescriptor
in interface Session
public ClassDescriptor getDescriptor(java.lang.Object domainObject)
getDescriptor
in interface Session
public ClassDescriptor getDescriptorForAlias(java.lang.String alias)
getDescriptorForAlias
in interface Session
public java.util.Map getDescriptors()
getDescriptors
in interface Session
public java.util.List getEjbqlPlaceHolderQueries()
getEjbqlPlaceHolderQueries
in interface Session
getAllQueries()
public SessionEventManager getEventManager()
getEventManager
in interface Session
public java.lang.String getExceptionHandlerClass()
public ExceptionHandler getExceptionHandler()
getExceptionHandler
in interface Session
public ExternalTransactionController getExternalTransactionController()
getExternalTransactionController
in interface Session
JTATransactionController
public IdentityMapAccessor getIdentityMapAccessor()
getIdentityMapAccessor
in interface Session
public IdentityMapAccessor getIdentityMapAccessorInstance()
public IntegrityChecker getIntegrityChecker()
getIntegrityChecker
in interface Session
public java.io.Writer getLog()
getLog
in interface Session
getSessionLog()
public java.lang.String getLogSessionString()
This should be the implementation of toString(), and also the value should be calculated in the constructor for it is used all the time. However everything is lazily initialized now and the value is transient for the system hashcode could vary?
public java.lang.String getSessionTypeString()
Override to hide from the user when they are using an internal subclass of a known class.
A user does not need to know that their UnitOfWork is a non-deferred UnitOfWork, or that their ClientSession is an IsolatedClientSession.
public DatabaseLogin getLogin()
public Login getDatasourceLogin()
getDatasourceLogin
in interface Session
public java.lang.String getName()
public java.lang.Number getNextSequenceNumberValue(java.lang.Class domainClass)
getNextSequenceNumberValue
in interface Session
public int getNumberOfActiveUnitsOfWork()
public DatabasePlatform getPlatform()
getPlatform
in interface Session
public Platform getDatasourcePlatform()
getDatasourcePlatform
in interface Session
public ServerPlatform getServerPlatform()
public Platform getPlatform(java.lang.Class domainClass)
public SessionProfiler getProfiler()
getProfiler
in interface Session
public Project getProject()
getProject
in interface Session
public java.util.Map getProperties()
getProperties
in interface Session
public boolean hasProperties()
public java.lang.Object getProperty(java.lang.String name)
getProperty
in interface Session
public java.util.Map getQueries()
getQueries
in interface Session
getAllQueries()
public java.util.Vector getAllQueries()
getQueries()
public DatabaseQuery getQuery(java.lang.String name)
public DatabaseQuery getQuery(java.lang.String name, java.util.Vector arguments)
getQuery
in interface Session
getQuery(String)
public Sequencing getSequencing()
public AbstractSession getSessionForClass(java.lang.Class domainClass)
public SessionLog getSessionLog()
getSessionLog
in interface Session
public ConcurrencyManager getTransactionMutex()
public java.lang.Object handleException(java.lang.RuntimeException exception) throws java.lang.RuntimeException
handleException
in interface Session
java.lang.RuntimeException
public boolean hasBroker()
public boolean hasDescriptor(java.lang.Class theClass)
hasDescriptor
in interface Session
public boolean hasExceptionHandler()
hasExceptionHandler
in interface Session
public boolean hasExternalTransactionController()
hasExternalTransactionController
in interface Session
JTATransactionController
public void initializeIdentityMapAccessor()
public java.lang.Object insertObject(java.lang.Object domainObject) throws DatabaseException
DatabaseException
- if an error occurs on the database,
these include constraint violations, security violations and general database erros.InsertObjectQuery
,
writeObject(Object)
public java.lang.Object internalExecuteQuery(DatabaseQuery query, AbstractRecord databaseRow) throws DatabaseException
DatabaseException
public boolean isBroker()
public boolean isInBroker()
public boolean isClassReadOnly(java.lang.Class theClass)
public boolean isClassReadOnly(java.lang.Class theClass, ClassDescriptor descriptor)
public boolean isClientSession()
isClientSession
in interface Session
public boolean isConnected()
isConnected
in interface Session
public boolean isDatabaseSession()
isDatabaseSession
in interface Session
public boolean isDistributedSession()
isDistributedSession
in interface Session
public boolean isInProfile()
isInProfile
in interface Session
public void setIsInProfile(boolean inProfile)
public boolean isInTransaction()
public boolean isRemoteSession()
isRemoteSession
in interface Session
public boolean isRemoteUnitOfWork()
isRemoteUnitOfWork
in interface Session
public boolean isServerSession()
isServerSession
in interface Session
public boolean isSessionBroker()
isSessionBroker
in interface Session
public boolean isUnitOfWork()
isUnitOfWork
in interface Session
public java.util.Vector keyFromObject(java.lang.Object domainObject) throws ValidationException
keyFromObject
in interface Session
ValidationException
public java.util.Vector keyFromObject(java.lang.Object domainObject, ClassDescriptor descriptor) throws ValidationException
ValidationException
public void log(SessionLogEntry entry)
public void logMessage(java.lang.String message)
logMessage
in interface Session
public DatabaseQuery prepareDatabaseQuery(DatabaseQuery query)
The call back occurs soon before we clone the query for execution, meaning that if this method needs to clone the query then the caller will determine that it doesn't need to clone the query itself.
public void processEJBQLQueries()
public void processEJBQLQueries(java.util.List queries)
public java.util.Vector readAllObjects(java.lang.Class domainClass) throws DatabaseException
readAllObjects
in interface Session
DatabaseException
ReadAllQuery
,
readAllObjects(Class, Expression)
public java.util.Vector readAllObjects(java.lang.Class domainClass, java.lang.String sqlString) throws DatabaseException
DatabaseException
ReadAllQuery
public java.util.Vector readAllObjects(java.lang.Class referenceClass, Call aCall) throws DatabaseException
readAllObjects
in interface Session
DatabaseException
Call
public java.util.Vector readAllObjects(java.lang.Class domainClass, Expression expression) throws DatabaseException
readAllObjects
in interface Session
DatabaseException
ReadAllQuery
public java.lang.Object readObject(java.lang.Class domainClass) throws DatabaseException
readObject
in interface Session
DatabaseException
ReadObjectQuery
,
readAllObjects(Class, Expression)
public java.lang.Object readObject(java.lang.Class domainClass, java.lang.String sqlString) throws DatabaseException
DatabaseException
ReadObjectQuery
public java.lang.Object readObject(java.lang.Class domainClass, Call aCall) throws DatabaseException
readObject
in interface Session
DatabaseException
SQLCall
,
EJBQLCall
public java.lang.Object readObject(java.lang.Class domainClass, Expression expression) throws DatabaseException
readObject
in interface Session
DatabaseException
ReadObjectQuery
public java.lang.Object readObject(java.lang.Object object) throws DatabaseException
readObject
in interface Session
DatabaseException
public java.lang.Object refreshAndLockObject(java.lang.Object object) throws DatabaseException
DatabaseException
#refreshAndLockObject(Object, lockMode)
public java.lang.Object refreshAndLockObject(java.lang.Object object, short lockMode) throws DatabaseException
Lock Modes: ObjectBuildingQuery.NO_LOCK, LOCK, LOCK_NOWAIT
DatabaseException
public java.lang.Object refreshObject(java.lang.Object object) throws DatabaseException
refreshObject
in interface Session
DatabaseException
public void release()
public void releaseUnitOfWork(UnitOfWorkImpl unitOfWork)
public void removeProperty(java.lang.String property)
removeProperty
in interface Session
public void removeQuery(java.lang.String queryName)
removeQuery
in interface Session
removeQuery(String, Vector)
public void removeQuery(java.lang.String queryName, java.util.Vector argumentTypes)
protected boolean rollbackExternalTransaction()
public void rollbackTransaction() throws DatabaseException, ConcurrencyException
DatabaseException
- if the database connection is lost or the rollback fails.ConcurrencyException
- if this session is not within a transaction.public void setAccessor(Accessor accessor)
public void setBroker(AbstractSession broker)
public void setCommitManager(CommitManager commitManager)
public void setEventManager(SessionEventManager eventManager)
public void setExceptionHandler(ExceptionHandler exceptionHandler)
setExceptionHandler
in interface Session
public void setExternalTransactionController(ExternalTransactionController externalTransactionController)
setExternalTransactionController
in interface Session
public void setIntegrityChecker(IntegrityChecker integrityChecker)
setIntegrityChecker
in interface Session
public void setLog(java.io.Writer log)
setLog
in interface Session
setSessionLog(SessionLog)
public void setLogin(DatabaseLogin login)
public void setLogin(Login login)
public void setDatasourceLogin(Login login)
public void setName(java.lang.String name)
protected void setNumberOfActiveUnitsOfWork(int numberOfActiveUnitsOfWork)
public void setProfiler(SessionProfiler profiler)
setProfiler
in interface Session
public void setProject(Project project)
public void setProperties(java.util.Hashtable properties)
public void setProperty(java.lang.String propertyName, java.lang.Object propertyValue)
setProperty
in interface Session
protected void setQueries(java.util.Hashtable queries)
public void setSessionLog(SessionLog sessionLog)
setSessionLog
in interface Session
logMessage(String)
protected void setTransactionMutex(ConcurrencyManager transactionMutex)
public void setWasJTSTransactionInternallyStarted(boolean wasJTSTransactionInternallyStarted)
public boolean shouldLogMessages()
shouldLogMessages
in interface Session
public void startOperationProfile(java.lang.String operationName)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object unwrapObject(java.lang.Object proxy)
public java.lang.Object updateObject(java.lang.Object domainObject) throws DatabaseException, OptimisticLockException
DatabaseException
- if an error occurs on the database,
these include constraint violations, security violations and general database erros.OptimisticLockException
- if the object's descriptor is using optimistic locking and
the object has been updated or deleted by another user since it was last read.UpdateObjectQuery
,
writeObject(Object)
public void validateQuery(DatabaseQuery query)
public boolean verifyDelete(java.lang.Object domainObject)
public boolean wasJTSTransactionInternallyStarted()
public java.lang.Object wrapObject(java.lang.Object implementation)
protected void writeAllObjects(IdentityHashtable domainObjects) throws DatabaseException, OptimisticLockException
protected void writeAllObjectsWithChangeSet(UnitOfWorkChangeSet uowChangeSet) throws DatabaseException, OptimisticLockException
public java.lang.Object writeObject(java.lang.Object domainObject) throws DatabaseException, OptimisticLockException
DatabaseException
- if an error occurs on the database,
these include constraint violations, security violations and general database erros.OptimisticLockException
- if the object's descriptor is using optimistic locking and
the object has been updated or deleted by another user since it was last read.WriteObjectQuery
,
insertObject(Object)
,
updateObject(Object)
public void writesCompleted()
public int getLogLevel(java.lang.String category)
Return the log level
getLogLevel
in interface Session
category
- the string representation of a TopLink category, e.g. "sql", "transaction" ...
public int getLogLevel()
Return the log level
getLogLevel
in interface Session
public void setLogLevel(int level)
Set the log level
setLogLevel
in interface Session
level
- the new log level
public boolean shouldLog(int Level, java.lang.String category)
Check if a message of the given level would actually be logged.
public void log(int level, java.lang.String category, java.lang.String message)
Log a message with level and category that needs to be translated.
public void log(int level, java.lang.String category, java.lang.String message, java.lang.Object param)
Log a message with level, category and a parameter that needs to be translated.
level
- the log request level value
message
- the string message
category
- the string representation of a TopLink category.
param
- a parameter of the message
public void log(int level, java.lang.String category, java.lang.String message, java.lang.Object param1, java.lang.Object param2)
Log a message with level, category and two parameters that needs to be translated.
level
- the log request level value
message
- the string message
category
- the string representation of a TopLink category.
param1
- a parameter of the message
param2
- second parameter of the message
public void log(int level, java.lang.String category, java.lang.String message, java.lang.Object param1, java.lang.Object param2, java.lang.Object param3)
Log a message with level, category and three parameters that needs to be translated.
level
- the log request level value
message
- the string message
category
- the string representation of a TopLink category.
param1
- a parameter of the message
param2
- second parameter of the message
param3
- third parameter of the message
public void log(int level, java.lang.String category, java.lang.String message, java.lang.Object[] params)
Log a message with level, category and an array of parameters that needs to be translated.
level
- the log request level value
message
- the string message
category
- the string representation of a TopLink category.
params
- array of parameters to the message
public void log(int level, java.lang.String category, java.lang.String message, java.lang.Object[] params, Accessor accessor)
Log a message with level, category, parameters and accessor that needs to be translated.
level
- the log request level value
message
- the string message
params
- array of parameters to the message
accessor
- the connection that generated the log entry
category
- the string representation of a TopLink category.
public void log(int level, java.lang.String category, java.lang.String message, java.lang.Object[] params, Accessor accessor, boolean shouldTranslate)
Log a message with level, category, parameters and accessor. shouldTranslate determines if the message needs to be translated.
level
- the log request level value
message
- the string message
params
- array of parameters to the message
accessor
- the connection that generated the log entry
category
- the string representation of a TopLink category.
shouldTranslate
- true if the message needs to be translated.
public void log(int level, java.lang.String message, java.lang.Object[] params, Accessor accessor)
Log a message with level, parameters and accessor that needs to be translated.
level
- the log request level value
message
- the string message
params
- array of parameters to the message
accessor
- the connection that generated the log entry
public void log(int level, java.lang.String message, java.lang.Object[] params, Accessor accessor, boolean shouldTranslate)
Log a message with level, parameters and accessor. shouldTranslate determines if the message needs to be translated.
level
- the log request level value
message
- the string message
params
- array of parameters to the message
accessor
- the connection that generated the log entry
shouldTranslate
- true if the message needs to be translated.
public void logThrowable(int level, java.lang.String category, java.lang.Throwable throwable)
Log a throwable with level and category.
logThrowable
in interface Session
level
- the log request level value
category
- the string representation of a TopLink category.
throwable
- a Throwable
public void severe(java.lang.String message, java.lang.String category)
This method is called when a severe level message needs to be logged. The message will be translated
message
- the message key
public void warning(java.lang.String message, java.lang.String category)
This method is called when a warning level message needs to be logged. The message will be translated
message
- the message key
public void info(java.lang.String message, java.lang.String category)
This method is called when a info level message needs to be logged. The message will be translated
message
- the message key
public void config(java.lang.String message, java.lang.String category)
This method is called when a config level message needs to be logged. The message will be translated
message
- the message key
public void fine(java.lang.String message, java.lang.String category)
This method is called when a fine level message needs to be logged. The message will be translated
message
- the message key
public void finer(java.lang.String message, java.lang.String category)
This method is called when a finer level message needs to be logged. The message will be translated
message
- the message key
public void finest(java.lang.String message, java.lang.String category)
This method is called when a finest level message needs to be logged. The message will be translated
message
- the message key
public java.lang.Object handleSevere(java.lang.RuntimeException exception) throws java.lang.RuntimeException
handleSevere
in interface Session
java.lang.RuntimeException