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:
UnitOfWork
,
DatabaseSession
,
oracle.toplink.essentials.publicinterface.Session
,
oracle.toplink.essentials.publicinterface.DatabaseSession
,
ServerSession
,
ClientSession
Modifier and Type | Method and Description |
---|---|
UnitOfWork |
acquireUnitOfWork()
PUBLIC:
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(String name,
DatabaseQuery query)
PUBLIC:
Add the query to the session queries with the given name.
|
void |
clearIntegrityChecker()
PUBLIC:
clear the integrityChecker, the integrityChecker holds all the Descriptor Exceptions.
|
void |
clearProfile()
PUBLIC:
Clear the profiler, this will end the current profile opperation.
|
boolean |
containsQuery(String queryName)
PUBLIC:
Return true if the pre-defined query is defined on the session.
|
Object |
copyObject(Object original)
PUBLIC:
Return a complete copy of the object.
|
Object |
copyObject(Object original,
ObjectCopyingPolicy policy)
PUBLIC:
Return a complete copy of the object.
|
boolean |
doesObjectExist(Object object)
PUBLIC:
Return if the object exists on the database or not.
|
void |
dontLogMessages()
PUBLIC:
Turn off logging
|
int |
executeNonSelectingCall(Call call)
PUBLIC:
Execute the call on the database.
|
void |
executeNonSelectingSQL(String sqlString)
PUBLIC:
Execute the non-selecting (update/DML) SQL string.
|
Object |
executeQuery(DatabaseQuery query)
PUBLIC:
Execute the database query.
|
Object |
executeQuery(DatabaseQuery query,
Vector argumentValues)
PUBLIC:
Return the results from exeucting the database query.
|
Object |
executeQuery(String queryName)
PUBLIC:
Execute the pre-defined query by name and return the result.
|
Object |
executeQuery(String queryName,
Class domainClass)
PUBLIC:
Execute the pre-defined query by name and return the result.
|
Object |
executeQuery(String queryName,
Class domainClass,
Object arg1)
PUBLIC:
Execute the pre-defined query by name and return the result.
|
Object |
executeQuery(String queryName,
Class domainClass,
Object arg1,
Object arg2)
PUBLIC:
Execute the pre-defined query by name and return the result.
|
Object |
executeQuery(String queryName,
Class domainClass,
Object arg1,
Object arg2,
Object arg3)
PUBLIC:
Execute the pre-defined query by name and return the result.
|
Object |
executeQuery(String queryName,
Class domainClass,
Vector argumentValues)
PUBLIC:
Execute the pre-defined query by name and return the result.
|
Object |
executeQuery(String queryName,
Object arg1)
PUBLIC:
Execute the pre-defined query by name and return the result.
|
Object |
executeQuery(String queryName,
Object arg1,
Object arg2)
PUBLIC:
Execute the pre-defined query by name and return the result.
|
Object |
executeQuery(String queryName,
Object arg1,
Object arg2,
Object arg3)
PUBLIC:
Execute the pre-defined query by name and return the result.
|
Object |
executeQuery(String queryName,
Vector argumentValues)
PUBLIC:
Execute the pre-defined query by name and return the result.
|
Vector |
executeSelectingCall(Call call)
PUBLIC:
Execute the call on the database and return the result.
|
Vector |
executeSQL(String sqlString)
PUBLIC:
Execute the selecting SQL string.
|
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.
|
ClassDescriptor |
getClassDescriptor(Class theClass)
ADVANCED:
Return the descriptor specified for the class.
|
ClassDescriptor |
getClassDescriptor(Object domainObject)
ADVANCED:
Return the descriptor specified for the object's class.
|
ClassDescriptor |
getClassDescriptorForAlias(String alias)
PUBLIC:
Return the descriptor for the alias.
|
Login |
getDatasourceLogin()
PUBLIC:
Return the login, the login holds any database connection information given.
|
Platform |
getDatasourcePlatform()
PUBLIC:
Return the database platform currently connected to.
|
ClassDescriptor |
getDescriptor(Class theClass)
ADVANCED:
Return the descriptor specified for the object's class.
|
ClassDescriptor |
getDescriptor(Object domainObject)
ADVANCED:
Return the descriptor specified for the object's class.
|
ClassDescriptor |
getDescriptorForAlias(String alias)
PUBLIC:
Return the descriptor for the alias.
|
Map |
getDescriptors()
ADVANCED:
Return all registered descriptors.
|
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.
|
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.
|
IntegrityChecker |
getIntegrityChecker()
PUBLIC:
Returns the integrityChecker,the integrityChecker holds all the Descriptor Exceptions.
|
Writer |
getLog()
PUBLIC:
Return the writer to which an accessor writes logged messages and SQL.
|
DatabaseLogin |
getLogin()
PUBLIC:
Return the login, the login holds any database connection information given.
|
int |
getLogLevel()
PUBLIC:
Return the log level
|
int |
getLogLevel(String category)
PUBLIC:
Return the log level
|
String |
getName()
PUBLIC:
Return the name of the session.
|
Number |
getNextSequenceNumberValue(Class domainClass)
ADVANCED:
Return the sequnce number from the database
|
DatabasePlatform |
getPlatform()
PUBLIC:
Return the database platform currently connected to.
|
SessionProfiler |
getProfiler()
PUBLIC:
Return the profiler.
|
Project |
getProject()
PUBLIC:
Return the project.
|
Map |
getProperties()
ADVANCED:
Allow for user defined properties.
|
Object |
getProperty(String name)
ADVANCED:
Returns the user defined property.
|
Map |
getQueries()
ADVANCED:
Return all pre-defined queries.
|
DatabaseQuery |
getQuery(String name)
PUBLIC:
Return the query from the session pre-defined queries with the given name.
|
DatabaseQuery |
getQuery(String name,
Vector arguments)
PUBLIC:
Return the query from the session pre-defined queries with the given name.
|
SessionLog |
getSessionLog()
PUBLIC:
Return the session log to which an accessor logs messages and SQL.
|
Object |
handleException(RuntimeException exception)
PUBLIC:
Allow any WARNING level exceptions that occur within TopLink to be logged and handled by the exception handler.
|
Object |
handleSevere(RuntimeException exception)
PUBLIC:
Allow any SEVERE level exceptions that occur within TopLink to be logged and handled by the exception handler.
|
boolean |
hasDescriptor(Class theClass)
ADVANCED:
Return true if a descriptor exists for the given class.
|
boolean |
hasExceptionHandler()
PUBLIC:
Return if an exception handler is present.
|
boolean |
hasExternalTransactionController()
PUBLIC:
Used for JTS integration.
|
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 |
isInProfile()
PUBLIC:
Return if a profiler is being used.
|
boolean |
isRemoteSession()
PUBLIC:
Return if this session is a remote session.
|
boolean |
isRemoteUnitOfWork()
PUBLIC:
Return if this session is a remote 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.
|
Vector |
keyFromObject(Object domainObject)
ADVANCED:
Extract and return the primary key from the object.
|
void |
log(int level,
String category,
String message)
PUBLIC:
|
void |
log(SessionLogEntry entry)
PUBLIC:
Log the log entry.
|
void |
logMessage(String message)
Log a untranslated message to the TopLink log at FINER level.
|
void |
logThrowable(int level,
String category,
Throwable throwable)
PUBLIC:
|
Vector |
readAllObjects(Class domainClass)
PUBLIC:
Read all of the instances of the class from the database.
|
Vector |
readAllObjects(Class domainClass,
Call aCall)
PUBLIC:
Read all the instances of the class from the database returned through execution the Call string.
|
Vector |
readAllObjects(Class domainClass,
Expression selectionCriteria)
PUBLIC:
Read all of the instances of the class from the database matching the given expression.
|
Object |
readObject(Class domainClass)
PUBLIC:
Read the first instance of the class from the database.
|
Object |
readObject(Class domainClass,
Call aCall)
PUBLIC:
Read the first instance of the class from the database returned through execution the Call string.
|
Object |
readObject(Class domainClass,
Expression selectionCriteria)
PUBLIC:
Read the first instance of the class from the database matching the given expression.
|
Object |
readObject(Object object)
PUBLIC:
Use the example object to consruct a read object query by the objects primary key.
|
Object |
refreshObject(Object object)
PUBLIC:
Refresh the attributes of the object and of all of its private parts from the database.
|
void |
release()
PUBLIC:
Release the session.
|
void |
removeProperty(String property)
PUBLIC:
Remove the user defined property.
|
void |
removeQuery(String queryName)
PUBLIC:
Remove the query name from the set of pre-defined queries
|
void |
setExceptionHandler(ExceptionHandler exceptionHandler)
PUBLIC:
Set the exceptionHandler.
|
void |
setExternalTransactionController(ExternalTransactionController externalTransactionController)
Set the transaction controller, allow integration with JTA.
|
void |
setIntegrityChecker(IntegrityChecker integrityChecker)
PUBLIC:
Set the integrityChecker, the integrityChecker holds all the Descriptor Exceptions.
|
void |
setLog(Writer log)
PUBLIC:
Set the writer to which an accessor writes logged messages and SQL.
|
void |
setLogLevel(int level)
PUBLIC:
Set the log level
|
void |
setName(String name)
PUBLIC:
Set the name of the session.
|
void |
setProfiler(SessionProfiler profiler)
PUBLIC:
Set the profiler for the session.
|
void |
setProperty(String propertyName,
Object propertyValue)
PUBLIC:
Allow for user defined properties.
|
void |
setSessionLog(SessionLog sessionLog)
PUBLIC:
Set the session log to which an accessor logs messages and SQL.
|
boolean |
shouldLog(int Level,
String category)
PUBLIC:
Check if a message of the given level would actually be logged.
|
boolean |
shouldLogMessages()
PUBLIC:
Return if logging is enabled (false if log level is OFF)
|
UnitOfWork acquireUnitOfWork()
UnitOfWork
void addQuery(String name, DatabaseQuery query)
void addEjbqlPlaceHolderQuery(DatabaseQuery query)
#getAllQueries()
void clearIntegrityChecker()
void clearProfile()
boolean containsQuery(String queryName)
Object copyObject(Object original)
copyObject(Object, ObjectCopyingPolicy)
Object copyObject(Object original, ObjectCopyingPolicy policy)
boolean doesObjectExist(Object object) throws DatabaseException
DatabaseException
void dontLogMessages()
int executeNonSelectingCall(Call call)
Example:
session.executeNonSelectingCall(new SQLCall("Delete from Employee");
executeSelectingCall(Call)
void executeNonSelectingSQL(String sqlString)
Object executeQuery(String queryName)
addQuery(String, DatabaseQuery)
Object executeQuery(String queryName, Class domainClass)
Object executeQuery(String queryName, Class domainClass, Object arg1)
Object executeQuery(String queryName, Class domainClass, Object arg1, Object arg2)
Object executeQuery(String queryName, Class domainClass, Object arg1, Object arg2, Object arg3)
Object executeQuery(String queryName, Class domainClass, Vector argumentValues)
Object executeQuery(String queryName, Object arg1)
addQuery(String, DatabaseQuery)
Object executeQuery(String queryName, Object arg1, Object arg2)
addQuery(String, DatabaseQuery)
Object executeQuery(String queryName, Object arg1, Object arg2, Object arg3)
addQuery(String, DatabaseQuery)
Object executeQuery(String queryName, Vector argumentValues)
addQuery(String, DatabaseQuery)
Object executeQuery(DatabaseQuery query) throws TopLinkException
TopLinkException
DatabaseQuery
Object executeQuery(DatabaseQuery query, Vector argumentValues)
Vector executeSelectingCall(Call call)
Example:
session.executeSelectingCall(new SQLCall("Select * from Employee");
executeNonSelectingCall(Call)
Vector executeSQL(String sqlString)
Session getActiveSession()
UnitOfWork getActiveUnitOfWork()
ClassDescriptor getClassDescriptor(Class theClass)
ClassDescriptor getClassDescriptor(Object domainObject)
ClassDescriptor getClassDescriptorForAlias(String alias)
ClassDescriptor getDescriptor(Class theClass)
ClassDescriptor getDescriptor(Object domainObject)
ClassDescriptor getDescriptorForAlias(String alias)
Map getDescriptors()
List getEjbqlPlaceHolderQueries()
#getAllQueries()
SessionEventManager getEventManager()
ExceptionHandler getExceptionHandler()
ExternalTransactionController getExternalTransactionController()
JTATransactionController
IdentityMapAccessor getIdentityMapAccessor()
IntegrityChecker getIntegrityChecker()
Writer getLog()
DatabasePlatform getPlatform()
Platform getDatasourcePlatform()
DatabaseLogin getLogin()
Login getDatasourceLogin()
String getName()
Number getNextSequenceNumberValue(Class domainClass)
SessionProfiler getProfiler()
Project getProject()
Map getProperties()
Map getQueries()
DatabaseQuery getQuery(String name)
DatabaseQuery getQuery(String name, Vector arguments)
SessionLog getSessionLog()
Object handleException(RuntimeException exception) throws RuntimeException
RuntimeException
boolean hasDescriptor(Class theClass)
boolean hasExceptionHandler()
boolean hasExternalTransactionController()
JTATransactionController
boolean isClientSession()
boolean isConnected()
boolean isDatabaseSession()
boolean isDistributedSession()
boolean isInProfile()
boolean isRemoteSession()
boolean isServerSession()
boolean isSessionBroker()
boolean isUnitOfWork()
boolean isRemoteUnitOfWork()
Vector keyFromObject(Object domainObject) throws ValidationException
ValidationException
void log(SessionLogEntry entry)
void logMessage(String message)
void log(int level, String category, String message)
Log a message with level and category.
level,
- the log request level value
message,
- the string message
category,
- the string representation of a TopLink category.
void logThrowable(int level, String category, Throwable throwable)
Log a throwable with level and category.
level,
- the log request level value
category,
- the string representation of a TopLink category.
throwable,
- a Throwable
Vector readAllObjects(Class domainClass) throws DatabaseException
DatabaseException
ReadAllQuery
,
readAllObjects(Class, Expression)
Vector readAllObjects(Class domainClass, Call aCall) throws DatabaseException
DatabaseException
SQLCall
,
EJBQLCall
Vector readAllObjects(Class domainClass, Expression selectionCriteria) throws DatabaseException
DatabaseException
ReadAllQuery
Object readObject(Class domainClass) throws DatabaseException
readObject(Class, Call)
, readObject(Class, Expression)
, or readObject(Object)
.DatabaseException
ReadObjectQuery
,
readAllObjects(Class, Expression)
Object readObject(Class domainClass, Call aCall) throws DatabaseException
DatabaseException
SQLCall
,
EJBQLCall
Object readObject(Class domainClass, Expression selectionCriteria) throws DatabaseException
DatabaseException
ReadObjectQuery
Object readObject(Object object) throws DatabaseException
DatabaseException
Object refreshObject(Object object)
void release()
void removeProperty(String property)
void removeQuery(String queryName)
void setExceptionHandler(ExceptionHandler exceptionHandler)
void setExternalTransactionController(ExternalTransactionController externalTransactionController)
void setIntegrityChecker(IntegrityChecker integrityChecker)
void setLog(Writer log)
void setName(String name)
void setProfiler(SessionProfiler profiler)
void setProperty(String propertyName, Object propertyValue)
void setSessionLog(SessionLog sessionLog)
boolean shouldLogMessages()
int getLogLevel(String category)
int getLogLevel()
void setLogLevel(int level)
boolean shouldLog(int Level, String category)
Object handleSevere(RuntimeException exception) throws RuntimeException
RuntimeException
Copyright © 2022. All rights reserved.