Methods Summary |
---|
public oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl | acquireNonSynchronizedUnitOfWork()INTERNAL:
Return a unit of work for this session not registered with the JTS transaction.
setNumberOfActiveUnitsOfWork(getNumberOfActiveUnitsOfWork() + 1);
UnitOfWorkImpl unitOfWork = new UnitOfWorkImpl(this);
if (shouldLog(SessionLog.FINER, SessionLog.TRANSACTION)) {
log(SessionLog.FINER, SessionLog.TRANSACTION, "acquire_unit_of_work_with_argument", String.valueOf(System.identityHashCode(unitOfWork)));
}
return unitOfWork;
|
public oracle.toplink.essentials.sessions.UnitOfWork | acquireUnitOfWork()PUBLIC:
Return a unit of work for this session.
The unit of work is an object level transaction that allows
a group of changes to be applied as a unit.
UnitOfWorkImpl unitOfWork = acquireNonSynchronizedUnitOfWork();
unitOfWork.registerWithTransactionIfRequired();
return unitOfWork;
|
public void | addAlias(java.lang.String alias, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)PUBLIC:
Add an alias for the descriptor
project.addAlias(alias, descriptor);
|
public void | addEjbqlPlaceHolderQuery(oracle.toplink.essentials.queryframework.DatabaseQuery query)INTERNAL:
Return all pre-defined not yet parsed EJBQL queries.
getEjbqlPlaceHolderQueries().add(query);
|
protected void | addQuery(oracle.toplink.essentials.queryframework.DatabaseQuery query)INTERNAL:
Add the query to the session queries.
Vector queriesByName = (Vector)getQueries().get(query.getName());
if (queriesByName == null) {
// lazily create Vector in Hashtable.
queriesByName = oracle.toplink.essentials.internal.helper.NonSynchronizedVector.newInstance();
getQueries().put(query.getName(), queriesByName);
}
// Check that we do not already have a query that matched it
for (Enumeration enumtr = queriesByName.elements(); enumtr.hasMoreElements();) {
DatabaseQuery existingQuery = (DatabaseQuery)enumtr.nextElement();
if (Helper.areTypesAssignable(query.getArgumentTypes(), existingQuery.getArgumentTypes())) {
throw ValidationException.existingQueryTypeConflict(query, existingQuery);
}
}
queriesByName.add(query);
|
public void | addQuery(java.lang.String name, oracle.toplink.essentials.queryframework.DatabaseQuery query)PUBLIC:
Add the query to the session queries with the given name.
This allows for common queries to be pre-defined, reused and executed by name.
query.setName(name);
addQuery(query);
|
public 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.
This starts a real database transaction.
try {
getAccessor().beginTransaction(this);
} catch (RuntimeException exception) {
handleException(exception);
}
|
protected void | basicCommitTransaction()INTERNAL:
Called by commitTransaction() to commit a transaction.
This commits the active transaction.
try {
getAccessor().commitTransaction(this);
} catch (RuntimeException exception) {
handleException(exception);
}
|
protected void | basicRollbackTransaction()INTERNAL:
Called by rollbackTransaction() to rollback a transaction.
This rollsback the active transaction.
try {
getAccessor().rollbackTransaction(this);
} catch (RuntimeException exception) {
handleException(exception);
}
|
public boolean | beginExternalTransaction()INTERNAL:
Attempts to begin an external transaction.
Returns true only in one case -
extenal transaction has been internally started during this method call:
wasJTSTransactionInternallyStarted()==false in the beginning of this method and
wasJTSTransactionInternallyStarted()==true in the end of this method.
boolean externalTransactionHasBegun = false;
if (hasExternalTransactionController() && !wasJTSTransactionInternallyStarted()) {
try {
getExternalTransactionController().beginTransaction(this);
} catch (RuntimeException exception) {
handleException(exception);
}
if (wasJTSTransactionInternallyStarted()) {
externalTransactionHasBegun = true;
log(SessionLog.FINER, SessionLog.TRANSACTION, "external_transaction_has_begun_internally");
}
}
return externalTransactionHasBegun;
|
public void | beginTransaction()PUBLIC:
Begin a transaction on the database.
This allows a group of database modification to be commited or rolledback as a unit.
All writes/deletes will be sent to the database be will not be visible to other users until commit.
Although databases do not allow nested transaction,
TopLink supports nesting through only committing to the database on the outer commit.
// If there is no db transaction in progress
// beginExternalTransaction() starts an external transaction -
// provided externalTransactionController is used, and there is
// no active external transaction - so we have to start one internally.
if (!isInTransaction()) {
beginExternalTransaction();
}
// For unit of work and client session multi threading is allowed as they are a context,
// this is required for JTS/RMI/CORBA/EJB stuff where the server thread can be different across calls.
if (isUnitOfWork() || isClientSession()) {
getTransactionMutex().setActiveThread(Thread.currentThread());
}
// Ensure mutual exclusion and call subclass specific begin.
getTransactionMutex().acquire();
if (!getTransactionMutex().isNested()) {
getEventManager().preBeginTransaction();
basicBeginTransaction();
getEventManager().postBeginTransaction();
}
|
public void | clearIntegrityChecker()PUBLIC:
clear the integrityChecker. IntegrityChecker holds all the Descriptor Exceptions.
setIntegrityChecker(null);
|
public void | clearLastDescriptorAccessed()INTERNAL:
clear the lastDescriptorAccessed.
lastDescriptorAccessed = null;
|
public void | clearProfile()PUBLIC:
Clear the profiler, this will end the current profile opperation.
setProfiler(null);
|
public java.lang.Object | clone()INTERNAL:
Clones the descriptor
// An alternative to this process should be found
try {
return super.clone();
} catch (Exception exception) {
return null;
}
|
public boolean | commitExternalTransaction()INTERNAL:
Attempts to commit the running internally started external transaction.
Returns true only in one case -
extenal transaction has been internally committed during this method call:
wasJTSTransactionInternallyStarted()==true in the beginning of this method and
wasJTSTransactionInternallyStarted()==false in the end of this method.
boolean externalTransactionHasCommitted = false;
if (hasExternalTransactionController() && wasJTSTransactionInternallyStarted()) {
try {
getExternalTransactionController().commitTransaction(this);
} catch (RuntimeException exception) {
handleException(exception);
}
if (!wasJTSTransactionInternallyStarted()) {
externalTransactionHasCommitted = true;
log(SessionLog.FINER, SessionLog.TRANSACTION, "external_transaction_has_committed_internally");
}
}
return externalTransactionHasCommitted;
|
public void | commitTransaction()PUBLIC:
Commit the active database transaction.
This allows a group of database modification to be commited or rolledback as a unit.
All writes/deletes will be sent to the database be will not be visible to other users until commit.
Although databases do not allow nested transaction,
TopLink supports nesting through only committing to the database on the outer commit.
// Release mutex and call subclass specific commit.
if (!getTransactionMutex().isNested()) {
getEventManager().preCommitTransaction();
basicCommitTransaction();
getEventManager().postCommitTransaction();
}
// This MUST not be in a try catch or finally as if the commit failed the transaction is still open.
getTransactionMutex().release();
// If there is no db transaction in progress
// if there is an active external transaction
// which was started internally - it should be committed internally, too.
if (!isInTransaction()) {
commitExternalTransaction();
}
|
public boolean | compareObjects(java.lang.Object firstObject, java.lang.Object secondObject)INTERNAL:
Return if the two object match completely.
This checks the objects attributes and their private parts.
if ((firstObject == null) && (secondObject == null)) {
return true;
}
if ((firstObject == null) || (secondObject == null)) {
return false;
}
if (!(firstObject.getClass().equals(secondObject.getClass()))) {
return false;
}
ObjectBuilder builder = getDescriptor(firstObject.getClass()).getObjectBuilder();
return builder.compareObjects(builder.unwrapObject(firstObject, this), builder.unwrapObject(secondObject, this), this);
|
public boolean | compareObjectsDontMatch(java.lang.Object firstObject, java.lang.Object secondObject)TESTING:
Return true if the object do not match.
This checks the objects attributes and their private parts.
return !this.compareObjects(firstObject, secondObject);
|
public void | config(java.lang.String message, java.lang.String category)PUBLIC:
This method is called when a config level message needs to be logged.
The message will be translated
log(SessionLog.CONFIG, category, message);
|
public boolean | containsQuery(java.lang.String queryName)PUBLIC:
Return true if the pre-defined query is defined on the session.
return getQueries().containsKey(queryName);
|
public java.lang.Object | copyObject(java.lang.Object original)PUBLIC:
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.
return copyObject(original, new ObjectCopyingPolicy());
|
public java.lang.Object | copyObject(java.lang.Object original, oracle.toplink.essentials.sessions.ObjectCopyingPolicy policy)PUBLIC:
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.
if (original == null) {
return null;
}
ClassDescriptor descriptor = getDescriptor(original);
if (descriptor == null) {
return original;
}
policy.setSession(this);
return descriptor.getObjectBuilder().copyObject(original, policy);
|
public 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
return getDefaultReadOnlyClasses();
|
public void | deleteAllObjects(java.util.Collection domainObjects)PUBLIC:
delete all of the objects and all of their privately owned parts in the database.
The allows for a group of objects to be deleted as a unit.
The objects will be deleted through a single transactions.
for (Iterator objectsEnum = domainObjects.iterator(); objectsEnum.hasNext();) {
deleteObject(objectsEnum.next());
}
|
public void | deleteAllObjects(java.util.Vector domainObjects)PUBLIC:
delete all of the objects and all of their privately owned parts in the database.
The allows for a group of objects to be deleted as a unit.
The objects will be deleted through a single transactions.
for (Enumeration objectsEnum = domainObjects.elements(); objectsEnum.hasMoreElements();) {
deleteObject(objectsEnum.nextElement());
}
|
public java.lang.Object | deleteObject(java.lang.Object domainObject)PUBLIC:
Delete the object and all of its privately owned parts from the database.
The delete operation can be customized through using a delete query.
DeleteObjectQuery query = new DeleteObjectQuery();
query.setObject(domainObject);
return executeQuery(query);
|
public boolean | doesObjectExist(java.lang.Object object)PUBLIC:
Return if the object exists on the database or not.
This always checks existence on the database.
DoesExistQuery query = new DoesExistQuery();
query.setObject(object);
query.checkDatabaseForDoesExist();
return ((Boolean)executeQuery(query)).booleanValue();
|
public void | dontLogMessages()PUBLIC:
Turn off logging
setLogLevel(SessionLog.OFF);
|
public void | endOperationProfile(java.lang.String operationName)INTERNAL:
End the operation timing.
if (isInProfile()) {
getProfiler().endOperationProfile(operationName);
}
|
public java.lang.Object | executeCall(oracle.toplink.essentials.queryframework.Call call, oracle.toplink.essentials.internal.sessions.AbstractRecord translationRow, oracle.toplink.essentials.queryframework.DatabaseQuery query)INTERNAL:
Overridden by subclasses that do more than just execute the call.
Executes the call directly on this session and does not check which
session it should have executed on.
//** sequencing refactoring
if (query.getAccessor() == null) {
query.setAccessor(getAccessor());
}
try {
return query.getAccessor().executeCall(call, translationRow, this);
} finally {
if (call.isFinished()) {
query.setAccessor(null);
}
}
|
public int | executeNonSelectingCall(oracle.toplink.essentials.queryframework.Call call)PUBLIC:
Execute the call on the database.
The row count is returned.
The call can be a stored procedure call, SQL call or other type of call.
Example:
session.executeNonSelectingCall(new SQLCall("Delete from Employee");
DataModifyQuery query = new DataModifyQuery();
query.setCall(call);
Integer value = (Integer)executeQuery(query);
if (value == null) {
return 0;
} else {
return value.intValue();
}
|
public void | executeNonSelectingSQL(java.lang.String sqlString)PUBLIC:
Execute the sql on the database.
Example:
session.executeNonSelectingSQL("Delete from Employee");
executeNonSelectingCall(new SQLCall(sqlString));
|
public java.lang.Object | executeQuery(java.lang.String queryName)PUBLIC:
Execute the pre-defined query by name and return the result.
Queries can be pre-defined and named to allow for their reuse.
DatabaseQuery query = getQuery(queryName);
if (query == null) {
throw QueryException.queryNotDefined(queryName);
}
return executeQuery(query);
|
public java.lang.Object | executeQuery(java.lang.String queryName, java.lang.Class domainClass)PUBLIC:
Execute the pre-defined query by name and return the result.
Queries can be pre-defined and named to allow for their reuse.
The class is the descriptor in which the query was pre-defined.
ClassDescriptor descriptor = getDescriptor(domainClass);
if (descriptor == null) {
throw QueryException.descriptorIsMissingForNamedQuery(domainClass, queryName);
}
DatabaseQuery query = (DatabaseQuery)descriptor.getQueryManager().getQuery(queryName);
if (query == null) {
throw QueryException.queryNotDefined(queryName, domainClass);
}
return executeQuery(query);
|
public 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.
Queries can be pre-defined and named to allow for their reuse.
The class is the descriptor in which the query was pre-defined.
Vector argumentValues = new Vector();
argumentValues.addElement(arg1);
return executeQuery(queryName, domainClass, argumentValues);
|
public 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.
Queries can be pre-defined and named to allow for their reuse.
The class is the descriptor in which the query was pre-defined.
Vector argumentValues = new Vector();
argumentValues.addElement(arg1);
argumentValues.addElement(arg2);
return executeQuery(queryName, domainClass, argumentValues);
|
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)PUBLIC:
Execute the pre-defined query by name and return the result.
Queries can be pre-defined and named to allow for their reuse.
The class is the descriptor in which the query was pre-defined.
Vector argumentValues = new Vector();
argumentValues.addElement(arg1);
argumentValues.addElement(arg2);
argumentValues.addElement(arg3);
return executeQuery(queryName, domainClass, argumentValues);
|
public 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.
Queries can be pre-defined and named to allow for their reuse.
The class is the descriptor in which the query was pre-defined.
ClassDescriptor descriptor = getDescriptor(domainClass);
if (descriptor == null) {
throw QueryException.descriptorIsMissingForNamedQuery(domainClass, queryName);
}
DatabaseQuery query = (DatabaseQuery)descriptor.getQueryManager().getQuery(queryName, argumentValues);
if (query == null) {
throw QueryException.queryNotDefined(queryName, domainClass);
}
return executeQuery(query, argumentValues);
|
public java.lang.Object | executeQuery(java.lang.String queryName, java.lang.Object arg1)PUBLIC:
Execute the pre-defined query by name and return the result.
Queries can be pre-defined and named to allow for their reuse.
Vector argumentValues = new Vector();
argumentValues.addElement(arg1);
return executeQuery(queryName, argumentValues);
|
public 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.
Queries can be pre-defined and named to allow for their reuse.
Vector argumentValues = new Vector();
argumentValues.addElement(arg1);
argumentValues.addElement(arg2);
return executeQuery(queryName, argumentValues);
|
public 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.
Queries can be pre-defined and named to allow for their reuse.
Vector argumentValues = new Vector();
argumentValues.addElement(arg1);
argumentValues.addElement(arg2);
argumentValues.addElement(arg3);
return executeQuery(queryName, argumentValues);
|
public java.lang.Object | executeQuery(java.lang.String queryName, java.util.Vector argumentValues)PUBLIC:
Execute the pre-defined query by name and return the result.
Queries can be pre-defined and named to allow for their reuse.
DatabaseQuery query = getQuery(queryName, argumentValues);
if (query == null) {
throw QueryException.queryNotDefined(queryName);
}
return executeQuery(query, argumentValues);
|
public java.lang.Object | executeQuery(oracle.toplink.essentials.queryframework.DatabaseQuery query)PUBLIC:
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.
return executeQuery(query, new DatabaseRecord(1));
|
public java.lang.Object | executeQuery(oracle.toplink.essentials.queryframework.DatabaseQuery query, java.util.Vector argumentValues)PUBLIC:
Return the results from exeucting the database query.
the arguments are passed in as a vector
if (query == null) {
throw QueryException.queryNotDefined();
}
AbstractRecord row = query.rowFromArguments(argumentValues);
return executeQuery(query, row);
|
public java.lang.Object | executeQuery(oracle.toplink.essentials.queryframework.DatabaseQuery query, oracle.toplink.essentials.internal.sessions.AbstractRecord row)INTERNAL:
Return the results from exeucting the database query.
the arguments should be a database row with raw data values.
if (hasBroker()) {
if (!((query.isDataModifyQuery() || query.isDataReadQuery()) && (query.getSessionName() == null))) {
return getBroker().executeQuery(query, row);
}
}
if (query == null) {
throw QueryException.queryNotDefined();
}
//CR#2272
log(SessionLog.FINEST, SessionLog.QUERY, "execute_query", query);
try {
getEventManager().preExecuteQuery(query);
Object result;
if (isInProfile()) {
result = getProfiler().profileExecutionOfQuery(query, row, this);
} else {
result = internalExecuteQuery(query, row);
}
getEventManager().postExecuteQuery(query, result);
return result;
} catch (RuntimeException exception) {
if (exception instanceof QueryException) {
QueryException queryException = (QueryException)exception;
if (queryException.getQuery() == null) {
queryException.setQuery(query);
}
if (queryException.getQueryArgumentsRecord() == null) {
queryException.setQueryArguments(row);
}
if (queryException.getSession() == null) {
queryException.setSession(this);
}
} else if (exception instanceof DatabaseException) {
DatabaseException databaseException = (DatabaseException)exception;
if (databaseException.getQuery() == null) {
databaseException.setQuery(query);
}
if (databaseException.getQueryArgumentsRecord() == null) {
databaseException.setQueryArguments(row);
}
if (databaseException.getSession() == null) {
databaseException.setSession(this);
}
}
return handleException(exception);
}
|
public java.util.Vector | executeSQL(java.lang.String sqlString)PUBLIC:
Execute the sql on the database and return the result.
It must return a value, if no value is return executeNonSelectingSQL must be used.
A vector of database rows is returned, database row implements Java 2 Map which should be used to access the data.
Example:
session.executeSelectingCall("Select * from Employee");
return executeSelectingCall(new SQLCall(sqlString));
|
public java.util.Vector | executeSelectingCall(oracle.toplink.essentials.queryframework.Call call)PUBLIC:
Execute the call on the database and return the result.
The call must return a value, if no value is return executeNonSelectCall must be used.
The call can be a stored procedure call, SQL call or other type of call.
A vector of database rows is returned, database row implements Java 2 Map which should be used to access the data.
Example:
session.executeSelectingCall(new SQLCall("Select * from Employee");
DataReadQuery query = new DataReadQuery();
query.setCall(call);
return (Vector)executeQuery(query);
|
public void | fine(java.lang.String message, java.lang.String category)PUBLIC:
This method is called when a fine level message needs to be logged.
The message will be translated
log(SessionLog.FINE, category, message);
|
public void | finer(java.lang.String message, java.lang.String category)PUBLIC:
This method is called when a finer level message needs to be logged.
The message will be translated
log(SessionLog.FINER, category, message);
|
public void | finest(java.lang.String message, java.lang.String category)PUBLIC:
This method is called when a finest level message needs to be logged.
The message will be translated
log(SessionLog.FINEST, category, message);
|
public synchronized oracle.toplink.essentials.internal.databaseaccess.Accessor | getAccessor()INTERNAL:
Return the lowlevel database accessor.
The database accesor is used for direct database access.
if ((accessor == null) && (project != null) && (project.getDatasourceLogin() != null)) {
// PERF: lazy init, not always required.
accessor = project.getDatasourceLogin().buildAccessor();
}
return accessor;
|
public oracle.toplink.essentials.internal.databaseaccess.Accessor | getAccessor(java.lang.Class domainClass)INTERNAL:
Return the lowlevel database accessor.
The database accesor is used for direct database access.
If sessionBroker is used, the right accessor for this
broker will be returned.
return getAccessor();
|
public oracle.toplink.essentials.internal.databaseaccess.Accessor | getAccessor(java.lang.String sessionName)INTERNAL:
Return the lowlevel database accessor.
The database accesor is used for direct database access.
If sessionBroker is used, the right accessor for this
broker will be returned based on the session name.
return getAccessor();
|
public oracle.toplink.essentials.sessions.Session | getActiveSession()PUBLIC:
Return the active session for the current active external (JTS) transaction.
This should only be used with JTS and will return the session if no external transaction exists.
oracle.toplink.essentials.sessions.Session activeSession = getActiveUnitOfWork();
if (activeSession == null) {
activeSession = this;
}
return activeSession;
|
public oracle.toplink.essentials.sessions.UnitOfWork | getActiveUnitOfWork()PUBLIC:
Return the active unit of work for the current active external (JTS) transaction.
This should only be used with JTS and will return null if no external transaction exists.
if (hasExternalTransactionController()) {
return getExternalTransactionController().getActiveUnitOfWork();
}
/* Steven Vo: CR# 2517
Get from the server session since the external transaction controller could be
null out from the client session by TL WebLogic 5.1 to provide non-jts transaction
operations
*/
if (isClientSession()) {
return ((oracle.toplink.essentials.threetier.ClientSession)this).getParent().getActiveUnitOfWork();
}
return null;
|
public java.util.Map | getAliasDescriptors()INTERNAL:
Returns the alias descriptors hashtable.
return project.getAliasDescriptors();
|
public java.util.Vector | getAllQueries()PUBLIC:
Return the pre-defined queries in this session.
A single vector containing all the queries is returned.
Vector allQueries = new Vector();
for (Iterator vectors = getQueries().values().iterator(); vectors.hasNext();) {
allQueries.addAll((Vector)vectors.next());
}
return allQueries;
|
public oracle.toplink.essentials.internal.sessions.AbstractSession | getBroker()INTERNAL:
Allow the session to be used from a session broker.
return broker;
|
public oracle.toplink.essentials.descriptors.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.
ClassDescriptor desc = getDescriptor(theClass);
if (desc instanceof ClassDescriptor) {
return (ClassDescriptor)desc;
} else {
throw ValidationException.cannotCastToClass(desc, desc.getClass(), ClassDescriptor.class);
}
|
public oracle.toplink.essentials.descriptors.ClassDescriptor | getClassDescriptor(java.lang.Object domainObject)ADVANCED:
Return the descriptor specified for the object's class.
ClassDescriptor desc = getDescriptor(domainObject);
if (desc instanceof ClassDescriptor) {
return (ClassDescriptor)desc;
} else {
throw ValidationException.cannotCastToClass(desc, desc.getClass(), ClassDescriptor.class);
}
|
public oracle.toplink.essentials.descriptors.ClassDescriptor | getClassDescriptorForAlias(java.lang.String alias)PUBLIC:
Return the descriptor for the alias.
UnitOfWork delegates this to the parent
return project.getClassDescriptorForAlias(alias);
|
public oracle.toplink.essentials.internal.sessions.CommitManager | getCommitManager()INTERNAL:
The commit manager is used to resolve referncial integrity on commits of multiple objects.
All brokered sessions share the same commit manager.
if (hasBroker()) {
return getBroker().getCommitManager();
}
// PERF: lazy init, not always required, not required for client sessions
if (commitManager == null) {
commitManager = new CommitManager(this);
}
return commitManager;
|
public oracle.toplink.essentials.sessions.Login | getDatasourceLogin()PUBLIC:
Return the login, the login holds any database connection information given.
This return the Login interface and may need to be cast to the datasource specific implementation.
return getProject().getDatasourceLogin();
|
public oracle.toplink.essentials.internal.databaseaccess.Platform | getDatasourcePlatform()PUBLIC:
Return the database platform currently connected to.
The platform is used for database specific behavoir.
// PERF: Cache the platform.
if (platform == null) {
platform = getDatasourceLogin().getDatasourcePlatform();
}
return platform;
|
public java.util.Vector | getDefaultReadOnlyClasses()INTERNAL:
Returns the set of read-only classes that gets assigned to each newly created UnitOfWork.
//Bug#3911318 All brokered sessions share the same DefaultReadOnlyClasses.
if (hasBroker()) {
return getBroker().getDefaultReadOnlyClasses();
}
return getProject().getDefaultReadOnlyClasses();
|
public oracle.toplink.essentials.descriptors.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.
if (theClass == null) {
return null;
}
// Optimize descriptor lookup through caching the last one accessed.
ClassDescriptor lastDescriptor = this.lastDescriptorAccessed;
if ((lastDescriptor != null) && (lastDescriptor.getJavaClass().equals(theClass))) {
return lastDescriptor;
}
ClassDescriptor descriptor = (ClassDescriptor)getDescriptors().get(theClass);
if ((descriptor == null) && hasBroker()) {
// Also check the broker
descriptor = getBroker().getDescriptor(theClass);
}
if (descriptor == null) {
// Allow for an event listener to lazy register the descriptor for a class.
getEventManager().missingDescriptor(theClass);
descriptor = (ClassDescriptor)getDescriptors().get(theClass);
}
if (descriptor == null) {
// This allows for the correct descriptor to be found if the class implements an interface,
// or extends a class that a descriptor is register for.
// This is used by EJB to find the descriptor for a stub and remote to unwrap it,
// and by inheritance to allow for subclasses that have no additional state to not require a descriptor.
if (!theClass.isInterface()) {
Class[] interfaces = theClass.getInterfaces();
for (int index = 0; index < interfaces.length; ++index) {
Class interfaceClass = (Class)interfaces[index];
descriptor = getDescriptor(interfaceClass);
if (descriptor != null) {
getDescriptors().put(interfaceClass, descriptor);
break;
}
}
if (descriptor == null) {
descriptor = getDescriptor(theClass.getSuperclass());
}
}
}
// Cache for optimization.
this.lastDescriptorAccessed = descriptor;
return descriptor;
|
public oracle.toplink.essentials.descriptors.ClassDescriptor | getDescriptor(java.lang.Object domainObject)ADVANCED:
Return the descriptor specified for the object's class.
return getDescriptor(domainObject.getClass());
|
public oracle.toplink.essentials.descriptors.ClassDescriptor | getDescriptorForAlias(java.lang.String alias)PUBLIC:
Return the descriptor for the alias
return project.getDescriptorForAlias(alias);
|
public java.util.Map | getDescriptors()ADVANCED:
Return all registered descriptors.
return getProject().getDescriptors();
|
public java.util.List | getEjbqlPlaceHolderQueries()ADVANCED:
Return all pre-defined not yet parsed EJBQL queries.
// PERF: lazy init, not normally required.
if (ejbqlPlaceHolderQueries == null) {
ejbqlPlaceHolderQueries = new Vector();
}
return ejbqlPlaceHolderQueries;
|
public synchronized oracle.toplink.essentials.sessions.SessionEventManager | getEventManager()PUBLIC:
Return the event manager.
The event manager can be used to register for various session events.
if (eventManager == null) {
// PERF: lazy init.
eventManager = new SessionEventManager(this);
}
return eventManager;
|
public oracle.toplink.essentials.exceptions.ExceptionHandler | getExceptionHandler()PUBLIC:
Return the ExceptionHandler.Exception handler can catch errors that occur on queries or during database access.
return exceptionHandler;
|
public java.lang.String | getExceptionHandlerClass()INTERNAL:
Return a string which represents my ExceptionHandler's class
Added for F2104: Properties.xml
- gn
String className = null;
try {
className = getExceptionHandler().getClass().getName();
} catch (Exception exception) {
return null;
}
return className;
|
public oracle.toplink.essentials.internal.sessions.AbstractSession | getExecutionSession(oracle.toplink.essentials.queryframework.DatabaseQuery query)INTERNAL:
Gets the session which this query will be executed on.
Generally will be called immediately before the call is translated,
which is immediately before session.executeCall.
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.
return this;
|
public oracle.toplink.essentials.sessions.ExternalTransactionController | getExternalTransactionController()PUBLIC:
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 several JTS implementations including JTS 1.0, Weblogic 5.1 and WebSphere 3.0.
return externalTransactionController;
|
public oracle.toplink.essentials.sessions.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.
return identityMapAccessor;
|
public oracle.toplink.essentials.internal.sessions.IdentityMapAccessor | getIdentityMapAccessorInstance()INTERNAL:
Return the internally available IdentityMapAccessor instance.
return identityMapAccessor;
|
public oracle.toplink.essentials.exceptions.IntegrityChecker | getIntegrityChecker()PUBLIC:
Returns the integrityChecker.IntegrityChecker holds all the Descriptor Exceptions.
// BUG# 2700595 - Lazily create an IntegrityChecker if one has not already been created.
if (integrityChecker == null) {
integrityChecker = new IntegrityChecker();
}
return integrityChecker;
|
public java.io.Writer | getLog()PUBLIC:
Return the writer to which an accessor writes logged messages and SQL.
If not set, this reference defaults to a writer on System.out.
return getSessionLog().getWriter();
|
public int | getLogLevel(java.lang.String category)PUBLIC:
Return the log level
return getSessionLog().getLevel(category);
|
public int | getLogLevel()PUBLIC:
Return the log level
return getSessionLog().getLevel();
|
public java.lang.String | getLogSessionString()INTERNAL:
Return the name of the session: class name + system hashcode.
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?
if (logSessionString == null) {
StringWriter writer = new StringWriter();
writer.write(getSessionTypeString());
writer.write("(");
writer.write(String.valueOf(System.identityHashCode(this)));
writer.write(")");
logSessionString = writer.toString();
}
return logSessionString;
|
public oracle.toplink.essentials.sessions.DatabaseLogin | getLogin()INTERNAL:
Return the login, the login holds any database connection information given.
This has been replaced by getDatasourceLogin to make use of the Login interface
to support non-relational datasources,
if DatabaseLogin API is required it will need to be cast.
try {
return (DatabaseLogin)getDatasourceLogin();
} catch (ClassCastException wrongType) {
throw ValidationException.notSupportedForDatasource();
}
|
public java.lang.String | getName()PUBLIC:
Return the name of the session.
This is used with the session broker, or to give the session a more meaningful name.
return name;
|
public long | getNextQueryId()INTERNAL:
Called by a sessions queries to obtain individual query ids.
CR #2698903
return QueryCounter.getCount();
|
public java.lang.Number | getNextSequenceNumberValue(java.lang.Class domainClass)ADVANCED:
Return the sequnce number from the database
return (Number)getSequencing().getNextValue(domainClass);
|
public int | getNumberOfActiveUnitsOfWork()INTERNAL:
Return the number of units of work connected.
return numberOfActiveUnitsOfWork;
|
public oracle.toplink.essentials.internal.sessions.AbstractSession | getParentIdentityMapSession(oracle.toplink.essentials.queryframework.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.
return getParentIdentityMapSession(query, false, false);
|
public oracle.toplink.essentials.internal.sessions.AbstractSession | getParentIdentityMapSession(oracle.toplink.essentials.queryframework.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.
Used for session broker which delegates to registered sessions, or UnitOfWork
which checks parent identity map also.
return this;
|
public oracle.toplink.essentials.internal.databaseaccess.DatabasePlatform | getPlatform()PUBLIC:
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.
// PERF: Cache the platform.
if (platform == null) {
platform = getDatasourceLogin().getPlatform();
}
return (DatabasePlatform)platform;
|
public oracle.toplink.essentials.internal.databaseaccess.Platform | getPlatform(java.lang.Class domainClass)INTERNAL:
Return the database platform currently connected to
for specified class.
The platform is used for database specific behavoir.
// PERF: Cache the platform.
if (platform == null) {
platform = getDatasourcePlatform();
}
return platform;
|
public oracle.toplink.essentials.sessions.SessionProfiler | getProfiler()PUBLIC:
Return the profiler.
The profiler is a tool that can be used to determine performance bottlenecks.
The profiler can be queries to print summaries and configure for logging purposes.
return profiler;
|
public oracle.toplink.essentials.sessions.Project | getProject()PUBLIC:
Return the project, the project holds configuartion information including the descriptors.
return project;
|
public java.util.Map | getProperties()ADVANCED:
Allow for user defined properties.
if (properties == null) {
properties = new HashMap(5);
}
return properties;
|
public java.lang.Object | getProperty(java.lang.String name)ADVANCED:
Returns the user defined property.
return getProperties().get(name);
|
public java.util.Map | getQueries()ADVANCED:
Return all pre-defined queries.
// PERF: lazy init, not normally required.
if (queries == null) {
queries = new HashMap(5);
}
return queries;
|
public oracle.toplink.essentials.queryframework.DatabaseQuery | getQuery(java.lang.String name)PUBLIC:
Return the query from the session pre-defined queries with the given name.
This allows for common queries to be pre-defined, reused and executed by name.
return getQuery(name, null);
|
public oracle.toplink.essentials.queryframework.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.
This allows for common queries to be pre-defined, reused and executed by name.
This method should be used if the Session has multiple queries with the same name but
different arguments.
Vector queries = (Vector)getQueries().get(name);
if ((queries == null) || queries.isEmpty()) {
return null;
}
// Short circuit the simple, most common case of only one query.
if (queries.size() == 1) {
return (DatabaseQuery)queries.firstElement();
}
// CR#3754; Predrag; mar 19/2002;
// We allow multiple named queries with the same name but
// different argument set; we can have only one query with
// no arguments; Vector queries is not sorted;
// When asked for the query with no parameters the
// old version did return the first query - wrong:
// return (DatabaseQuery) queries.firstElement();
int argumentTypesSize = 0;
if (arguments != null) {
argumentTypesSize = arguments.size();
}
Vector argumentTypes = new Vector(argumentTypesSize);
for (int i = 0; i < argumentTypesSize; i++) {
argumentTypes.addElement(arguments.elementAt(i).getClass());
}
for (Enumeration queriesEnum = queries.elements(); queriesEnum.hasMoreElements();) {
DatabaseQuery query = (DatabaseQuery)queriesEnum.nextElement();
if (Helper.areTypesAssignable(argumentTypes, query.getArgumentTypes())) {
return query;
}
}
return null;
|
public oracle.toplink.essentials.internal.sessions.AbstractSession | getRootSession(oracle.toplink.essentials.queryframework.DatabaseQuery query)INTERNAL:
The session that this query is executed against when not in transaction.
The session containing the shared identity map.
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:
- A ClientSession if in transaction
- An isolated ClientSession or HistoricalSession
- A registered session of a root SessionBroker
return getParentIdentityMapSession(query, false, true);
|
public oracle.toplink.essentials.internal.sequencing.Sequencing | getSequencing()INTERNAL:
Return the Sequencing object used by the session.
return null;
|
public oracle.toplink.essentials.platform.server.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)
return null;
|
public oracle.toplink.essentials.internal.sessions.AbstractSession | getSessionForClass(java.lang.Class domainClass)INTERNAL:
Return the session to be used for the class.
Used for compatibility with the session broker.
if (hasBroker()) {
return getBroker().getSessionForClass(domainClass);
}
return this;
|
public oracle.toplink.essentials.logging.SessionLog | getSessionLog()PUBLIC:
Return the session log to which an accessor logs messages and SQL.
If not set, this will default to a session log on a writer on System.out.
if (sessionLog == null) {
setSessionLog(new DefaultSessionLog());
}
return sessionLog;
|
public java.lang.String | getSessionTypeString()INTERNAL:
Returns the type of session, its class.
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.
return Helper.getShortClassName(getClass());
|
public synchronized oracle.toplink.essentials.internal.helper.ConcurrencyManager | getTransactionMutex()INTERNAL:
The transaction mutex ensure mutual exclusion on transaction across multiple threads.
// PERF: not always required, defer.
if (transactionMutex == null) {
transactionMutex = new ConcurrencyManager();
}
return transactionMutex;
|
public 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.
if ((exception instanceof TopLinkException)) {
TopLinkException topLinkException = (TopLinkException)exception;
if (topLinkException.getSession() == null) {
topLinkException.setSession(this);
}
//Bug#3559280 Avoid logging an exception twice
if (!topLinkException.hasBeenLogged()) {
logThrowable(SessionLog.WARNING, null, exception);
topLinkException.setHasBeenLogged(true);
}
} else {
logThrowable(SessionLog.WARNING, null, exception);
}
if (hasExceptionHandler()) {
return getExceptionHandler().handleException(exception);
} else {
throw exception;
}
|
public 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.
logThrowable(SessionLog.SEVERE, null, exception);
if (hasExceptionHandler()) {
return getExceptionHandler().handleException(exception);
} else {
throw exception;
}
|
public boolean | hasBroker()INTERNAL:
Allow the session to be used from a session broker.
return broker != null;
|
public boolean | hasDescriptor(java.lang.Class theClass)ADVANCED:
Return true if a descriptor exists for the given class.
if (theClass == null) {
return false;
}
return getDescriptors().get(theClass) != null;
|
public boolean | hasExceptionHandler()PUBLIC:
Return if an exception handler is present.
if (exceptionHandler == null) {
return false;
}
return true;
|
public boolean | hasExternalTransactionController()PUBLIC:
Used for JTA integration. If your application requires to have JTA control transactions instead of TopLink an
external transaction controler must be specified. TopLink provides JTA controlers for JTA 1.0 and application
servers.
return externalTransactionController != null;
|
public boolean | hasProperties()INTERNAL:
Allow to check for user defined properties.
return ((properties != null) && !properties.isEmpty());
|
public void | incrementProfile(java.lang.String operationName)INTERNAL:
Updates the count of SessionProfiler event
if (isInProfile()) {
getProfiler().occurred(operationName);
}
|
public void | info(java.lang.String message, java.lang.String category)PUBLIC:
This method is called when a info level message needs to be logged.
The message will be translated
log(SessionLog.INFO, category, message);
|
public void | initializeIdentityMapAccessor()INTERNAL:
Set up the IdentityMapManager. This method allows subclasses of Session to override
the default IdentityMapManager functionality.
this.identityMapAccessor = new oracle.toplink.essentials.internal.sessions.IdentityMapAccessor(this, new IdentityMapManager(this));
|
public java.lang.Object | insertObject(java.lang.Object domainObject)PUBLIC:
Insert the object and all of its privately owned parts into the database.
Insert should only be used if the application knows that the object is new,
otherwise writeObject should be used.
The insert operation can be customized through using an insert query.
InsertObjectQuery query = new InsertObjectQuery();
query.setObject(domainObject);
return executeQuery(query);
|
public java.lang.Object | internalExecuteQuery(oracle.toplink.essentials.queryframework.DatabaseQuery query, oracle.toplink.essentials.internal.sessions.AbstractRecord databaseRow)INTERNAL:
Return the results from exeucting the database query.
The arguments should be a database row with raw data values.
This method is provided to allow subclasses to change the default querying behavoir.
All querying goes through this method.
return query.execute(this, databaseRow);
|
public boolean | isBroker()INTERNAL:
Returns true if the session is a session Broker.
return false;
|
public boolean | isClassReadOnly(java.lang.Class theClass)PUBLIC:
Return if the class is defined as read-only.
ClassDescriptor descriptor = getDescriptor(theClass);
return isClassReadOnly(theClass, descriptor);
|
public boolean | isClassReadOnly(java.lang.Class theClass, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)INTERNAL:
Return if the class is defined as read-only.
PERF: Pass descriptor to avoid re-lookup.
if ((descriptor != null) && descriptor.shouldBeReadOnly()) {
return true;
}
if (theClass != null) {
return getDefaultReadOnlyClasses().contains(theClass);
}
return false;
|
public boolean | isClientSession()PUBLIC:
Return if this session is a client session.
return false;
|
public boolean | isConnected()PUBLIC:
Return if this session is connected to the database.
if (getAccessor() == null) {
return false;
}
return getAccessor().isConnected();
|
public boolean | isDatabaseSession()PUBLIC:
Return if this session is a database session.
return false;
|
public boolean | isDistributedSession()PUBLIC:
Return if this session is a distributed session.
return false;
|
public boolean | isInBroker()INTERNAL:
Returns true if the session is in a session Broker.
return false;
|
public boolean | isInProfile()PUBLIC:
Return if a profiler is being used.
return isInProfile;
|
public boolean | isInTransaction()PUBLIC:
Return if the session is currently in the progress of a database transaction.
Because nested transactions are allowed check if the transaction mutex has been aquired.
return getTransactionMutex().isAcquired();
|
public boolean | isRemoteSession()PUBLIC:
Return if this session is remote.
return false;
|
public boolean | isRemoteUnitOfWork()PUBLIC:
Return if this session is a unit of work.
return false;
|
public boolean | isServerSession()PUBLIC:
Return if this session is a server session.
return false;
|
public boolean | isSessionBroker()PUBLIC:
Return if this session is a session broker.
return false;
|
public boolean | isUnitOfWork()PUBLIC:
Return if this session is a unit of work.
return false;
|
public java.util.Vector | keyFromObject(java.lang.Object domainObject)ADVANCED:
Extract and return the primary key from the object.
ClassDescriptor descriptor = getDescriptor(domainObject);
return keyFromObject(domainObject, descriptor);
|
public java.util.Vector | keyFromObject(java.lang.Object domainObject, oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)ADVANCED:
Extract and return the primary key from the object.
if (descriptor == null) {
throw ValidationException.missingDescriptor(domainObject.getClass().getName());
}
Object implemention = descriptor.getObjectBuilder().unwrapObject(domainObject, this);
if (implemention == null) {
return null;
}
return descriptor.getObjectBuilder().extractPrimaryKeyFromObject(implemention, this);
|
public void | log(oracle.toplink.essentials.logging.SessionLogEntry entry)PUBLIC:
Log the log entry.
if (shouldLog(entry.getLevel(), entry.getNameSpace())) {
if (entry.getSession() == null) {// Used for proxy session.
entry.setSession(this);
}
getSessionLog().log(entry);
}
|
public void | log(int level, java.lang.String category, java.lang.String message)PUBLIC:
Log a message with level and category that needs to be translated.
if (!shouldLog(level, category)) {
return;
}
log(level, category, message, (Object[])null);
|
public void | log(int level, java.lang.String category, java.lang.String message, java.lang.Object param)INTERNAL:
Log a message with level, category and a parameter that needs to be translated.
if (!shouldLog(level, category)) {
return;
}
log(level, category, message, new Object[] { param });
|
public void | log(int level, java.lang.String category, java.lang.String message, java.lang.Object param1, java.lang.Object param2)INTERNAL:
Log a message with level, category and two parameters that needs to be translated.
if (!shouldLog(level, category)) {
return;
}
log(level, category, message, new Object[] { param1, param2 });
|
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)INTERNAL:
Log a message with level, category and three parameters that needs to be translated.
if (!shouldLog(level, category)) {
return;
}
log(level, category, message, new Object[] { param1, param2, param3 });
|
public void | log(int level, java.lang.String category, java.lang.String message, java.lang.Object[] params)INTERNAL:
Log a message with level, category and an array of parameters that needs to be translated.
log(level, category, message, params, null);
|
public void | log(int level, java.lang.String category, java.lang.String message, java.lang.Object[] params, oracle.toplink.essentials.internal.databaseaccess.Accessor accessor)INTERNAL:
Log a message with level, category, parameters and accessor that needs to be translated.
log(level, category, message, params, accessor, true);
|
public void | log(int level, java.lang.String category, java.lang.String message, java.lang.Object[] params, oracle.toplink.essentials.internal.databaseaccess.Accessor accessor, boolean shouldTranslate)INTERNAL:
Log a message with level, category, parameters and accessor. shouldTranslate determines if the message needs to be translated.
if (shouldLog(level, category)) {
startOperationProfile(SessionProfiler.Logging);
log(new SessionLogEntry(level, category, this, message, params, accessor, shouldTranslate));
endOperationProfile(SessionProfiler.Logging);
}
|
public void | log(int level, java.lang.String message, java.lang.Object[] params, oracle.toplink.essentials.internal.databaseaccess.Accessor accessor)INTERNAL:
Log a message with level, parameters and accessor that needs to be translated.
log(level, message, params, accessor, true);
|
public void | log(int level, java.lang.String message, java.lang.Object[] params, oracle.toplink.essentials.internal.databaseaccess.Accessor accessor, boolean shouldTranslate)INTERNAL:
Log a message with level, parameters and accessor. shouldTranslate determines if the message needs to be translated.
if (shouldLog(level, null)) {
startOperationProfile(SessionProfiler.Logging);
log(new SessionLogEntry(level, this, message, params, accessor, shouldTranslate));
endOperationProfile(SessionProfiler.Logging);
}
|
public void | logMessage(java.lang.String message)Log a untranslated message to the TopLink log at FINER level.
log(SessionLog.FINER, message, (Object[])null, null, false);
|
public void | logThrowable(int level, java.lang.String category, java.lang.Throwable throwable)PUBLIC:
Log a throwable with level and category.
// Must not create the log if not logging as is a performance issue.
if (shouldLog(level, category)) {
startOperationProfile(SessionProfiler.Logging);
log(new SessionLogEntry(this, level, category, throwable));
endOperationProfile(SessionProfiler.Logging);
}
|
public oracle.toplink.essentials.queryframework.DatabaseQuery | prepareDatabaseQuery(oracle.toplink.essentials.queryframework.DatabaseQuery query)INTERNAL:
A call back to do session specific preparation of a 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.
if (!isUnitOfWork() && query.isObjectLevelReadQuery()) {
return ((ObjectLevelReadQuery)query).prepareOutsideUnitOfWork(this);
} else {
return query;
}
|
public void | processEJBQLQueries()INTERNAL:
Allows for EJBQL strings to be parsed and added as named queries. Should
be called after descriptors have been initialized to ensure all mappings
exist.
List queries = getEjbqlPlaceHolderQueries();
processEJBQLQueries(queries);
queries.clear();
|
public void | processEJBQLQueries(java.util.List queries)INTERNAL:
Allows for EJBQL strings to be parsed and added as named queries. Should
be called after descriptors have been initialized to ensure all mappings
exist.
for (Iterator iterator = queries.iterator(); iterator.hasNext();) {
EJBQLPlaceHolderQuery existingQuery = (EJBQLPlaceHolderQuery)iterator.next();
this.addQuery(existingQuery.processEjbQLQuery(this));
}
|
public java.util.Vector | readAllObjects(java.lang.Class domainClass)PUBLIC:
Read all of the instances of the class from the database.
This operation can be customized through using a ReadAllQuery,
or through also passing in a selection criteria.
ReadAllQuery query = new ReadAllQuery();
query.setReferenceClass(domainClass);
return (Vector)executeQuery(query);
|
public 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.
The SQL string must be a valid SQL select statement or selecting stored procedure call.
This operation can be customized through using a ReadAllQuery.
ReadAllQuery query = new ReadAllQuery();
query.setReferenceClass(domainClass);
query.setSQLString(sqlString);
return (Vector)executeQuery(query);
|
public java.util.Vector | readAllObjects(java.lang.Class referenceClass, oracle.toplink.essentials.queryframework.Call aCall)PUBLIC:
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"));
ReadAllQuery raq = new ReadAllQuery();
raq.setReferenceClass(referenceClass);
raq.setCall(aCall);
return (Vector)executeQuery(raq);
|
public java.util.Vector | readAllObjects(java.lang.Class domainClass, oracle.toplink.essentials.expressions.Expression expression)PUBLIC:
Read all of the instances of the class from the database matching the given expression.
This operation can be customized through using a ReadAllQuery.
ReadAllQuery query = new ReadAllQuery();
query.setReferenceClass(domainClass);
query.setSelectionCriteria(expression);
return (Vector)executeQuery(query);
|
public java.lang.Object | readObject(java.lang.Class domainClass)PUBLIC:
Read the first instance of the class from the database.
This operation can be customized through using a ReadObjectQuery,
or through also passing in a selection criteria.
ReadObjectQuery query = new ReadObjectQuery();
query.setReferenceClass(domainClass);
return executeQuery(query);
|
public 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.
The SQL string must be a valid SQL select statement or selecting stored procedure call.
This operation can be customized through using a ReadObjectQuery.
ReadObjectQuery query = new ReadObjectQuery();
query.setReferenceClass(domainClass);
query.setSQLString(sqlString);
return executeQuery(query);
|
public java.lang.Object | readObject(java.lang.Class domainClass, oracle.toplink.essentials.queryframework.Call aCall)PUBLIC:
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"));
ReadObjectQuery query = new ReadObjectQuery();
query.setReferenceClass(domainClass);
query.setCall(aCall);
return executeQuery(query);
|
public java.lang.Object | readObject(java.lang.Class domainClass, oracle.toplink.essentials.expressions.Expression expression)PUBLIC:
Read the first instance of the class from the database matching the given expression.
This operation can be customized through using a ReadObjectQuery.
ReadObjectQuery query = new ReadObjectQuery();
query.setReferenceClass(domainClass);
query.setSelectionCriteria(expression);
return executeQuery(query);
|
public java.lang.Object | readObject(java.lang.Object object)PUBLIC:
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.
ReadObjectQuery query = new ReadObjectQuery();
query.setSelectionObject(object);
return executeQuery(query);
|
public 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.
The object will be pessimisticly locked on the database for the duration of the transaction.
If the object is already locked this method will wait until the lock is released.
A no wait option is available through setting the lock mode.
ReadObjectQuery query = new ReadObjectQuery();
query.setSelectionObject(object);
query.refreshIdentityMapResult();
query.cascadePrivateParts();
query.setLockMode(ObjectBuildingQuery.LOCK);
return executeQuery(query);
|
public 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.
The object will be pessimisticly locked on the database for the duration of the transaction.
Lock Modes: ObjectBuildingQuery.NO_LOCK, LOCK, LOCK_NOWAIT
ReadObjectQuery query = new ReadObjectQuery();
query.setSelectionObject(object);
query.refreshIdentityMapResult();
query.cascadePrivateParts();
query.setLockMode(lockMode);
return executeQuery(query);
|
public 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.
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.
return refreshAndLockObject(object, ObjectBuildingQuery.NO_LOCK);
|
public void | release()PUBLIC:
Release the session.
This does nothing by default, but allows for other sessions such as the ClientSession to do something.
|
public void | releaseUnitOfWork(oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl unitOfWork)INTERNAL:
Release the unit of work, if lazy release the connection.
// Nothing is required by default, allow subclasses to do cleanup.
setNumberOfActiveUnitsOfWork(getNumberOfActiveUnitsOfWork() - 1);
|
public void | removeProperty(java.lang.String property)PUBLIC:
Remove the user defined property.
getProperties().remove(property);
|
public void | removeQuery(java.lang.String queryName)PUBLIC:
Remove all queries with the given queryName regardless of the argument types.
getQueries().remove(queryName);
|
public void | removeQuery(java.lang.String queryName, java.util.Vector argumentTypes)PUBLIC:
Remove the specific query with the given queryName and argumentTypes.
Vector queries = (Vector)getQueries().get(queryName);
if (queries == null) {
return;
} else {
DatabaseQuery query = null;
for (Enumeration enumtr = queries.elements(); enumtr.hasMoreElements();) {
query = (DatabaseQuery)enumtr.nextElement();
if (Helper.areTypesAssignable(argumentTypes, query.getArgumentTypes())) {
break;
}
}
if (query != null) {
queries.remove(query);
}
}
|
protected boolean | rollbackExternalTransaction()PROTECTED:
Attempts to rollback the running internally started external transaction.
Returns true only in one case -
extenal transaction has been internally rolled back during this method call:
wasJTSTransactionInternallyStarted()==true in the beginning of this method and
wasJTSTransactionInternallyStarted()==false in the end of this method.
boolean externalTransactionHasRolledBack = false;
if (hasExternalTransactionController() && wasJTSTransactionInternallyStarted()) {
try {
getExternalTransactionController().rollbackTransaction(this);
} catch (RuntimeException exception) {
handleException(exception);
}
if (!wasJTSTransactionInternallyStarted()) {
externalTransactionHasRolledBack = true;
log(SessionLog.FINER, SessionLog.TRANSACTION, "external_transaction_has_rolled_back_internally");
}
}
return externalTransactionHasRolledBack;
|
public void | rollbackTransaction()PUBLIC:
Rollback the active database transaction.
This allows a group of database modification to be commited or rolledback as a unit.
All writes/deletes will be sent to the database be will not be visible to other users until commit.
Although databases do not allow nested transaction,
TopLink supports nesting through only committing to the database on the outer commit.
// Ensure release of mutex and call subclass specific release.
try {
if (!getTransactionMutex().isNested()) {
getEventManager().preRollbackTransaction();
basicRollbackTransaction();
getEventManager().postRollbackTransaction();
}
} finally {
getTransactionMutex().release();
// If there is no db transaction in progress
// if there is an active external transaction
// which was started internally - it should be rolled back internally, too.
if (!isInTransaction()) {
rollbackExternalTransaction();
}
}
|
public void | setAccessor(oracle.toplink.essentials.internal.databaseaccess.Accessor accessor)INTERNAL:
Set the accessor.
this.accessor = accessor;
|
public void | setBroker(oracle.toplink.essentials.internal.sessions.AbstractSession broker)INTERNAL:
Allow the session to be used from a session broker.
this.broker = broker;
|
public void | setCommitManager(oracle.toplink.essentials.internal.sessions.CommitManager commitManager)INTERNAL:
The commit manager is used to resolve referncial integrity on commits of multiple objects.
this.commitManager = commitManager;
|
public void | setDatasourceLogin(oracle.toplink.essentials.sessions.Login login)PUBLIC:
Set the login.
getProject().setDatasourceLogin(login);
|
public void | setEventManager(oracle.toplink.essentials.sessions.SessionEventManager eventManager)INTERNAL:
Set the event manager.
The event manager can be used to register for various session events.
if (eventManager != null) {
this.eventManager = eventManager;
} else {
this.eventManager = new SessionEventManager();
}
this.eventManager.setSession(this);
|
public void | setExceptionHandler(oracle.toplink.essentials.exceptions.ExceptionHandler exceptionHandler)PUBLIC:
Set the exceptionHandler.
Exception handler can catch errors that occur on queries or during database access.
this.exceptionHandler = exceptionHandler;
|
public void | setExternalTransactionController(oracle.toplink.essentials.sessions.ExternalTransactionController externalTransactionController)Used for JTS integration internally by ServerPlatform.
this.externalTransactionController = externalTransactionController;
if (externalTransactionController == null) {
return;
}
externalTransactionController.setSession(this);
|
public void | setIntegrityChecker(oracle.toplink.essentials.exceptions.IntegrityChecker integrityChecker)PUBLIC:
set the integrityChecker. IntegrityChecker holds all the Descriptor Exceptions.
this.integrityChecker = integrityChecker;
|
public void | setIsInProfile(boolean inProfile)PUBLIC:
Allow for user deactive a profiler
this.isInProfile = inProfile;
|
public void | setLog(java.io.Writer log)PUBLIC:
Set the writer to which an accessor writes logged messages and SQL.
If not set, this reference defaults to a writer on System.out.
getSessionLog().setWriter(log);
|
public void | setLogLevel(int level)PUBLIC:
Set the log level
getSessionLog().setLevel(level);
|
public void | setLogin(oracle.toplink.essentials.sessions.DatabaseLogin login)PUBLIC:
Set the login.
setDatasourceLogin(login);
|
public void | setLogin(oracle.toplink.essentials.sessions.Login login)PUBLIC:
Set the login.
setDatasourceLogin(login);
|
public void | setName(java.lang.String name)PUBLIC:
Set the name of the session.
This is used with the session broker.
this.name = name;
|
protected void | setNumberOfActiveUnitsOfWork(int numberOfActiveUnitsOfWork)
this.numberOfActiveUnitsOfWork = numberOfActiveUnitsOfWork;
|
public void | setProfiler(oracle.toplink.essentials.sessions.SessionProfiler profiler)PUBLIC:
Set the profiler for the session.
This allows for performance operations to be profiled.
this.profiler = profiler;
if (profiler != null) {
profiler.setSession(this);
setIsInProfile(getProfiler().getProfileWeight() != SessionProfiler.NONE);
// Clear cached flag that bybasses the profiler check.
getIdentityMapAccessorInstance().getIdentityMapManager().clearCacheAccessPreCheck();
} else {
setIsInProfile(false);
}
|
public void | setProject(oracle.toplink.essentials.sessions.Project project)INTERNAL:
Set the project, the project holds configuartion information including the descriptors.
this.project = project;
|
public void | setProperties(java.util.Hashtable properties)INTERNAL:
Set the user defined properties.
this.properties = properties;
|
public void | setProperty(java.lang.String propertyName, java.lang.Object propertyValue)PUBLIC:
Allow for user defined properties.
getProperties().put(propertyName, propertyValue);
|
protected void | setQueries(java.util.Hashtable queries)
this.queries = queries;
|
public void | setSessionLog(oracle.toplink.essentials.logging.SessionLog sessionLog)PUBLIC:
Set the session log to which an accessor logs messages and SQL.
If not set, this will default to a session log on a writer on System.out.
To enable logging, log level can not be OFF.
Also set a backpointer to this session in SessionLog. To avoid a sessionLog
being shared by more than one session, it needs to be cloned.
this.sessionLog = (SessionLog)((AbstractSessionLog)sessionLog).clone();
if (this.sessionLog != null) {
this.sessionLog.setSession(this);
}
|
protected void | setTransactionMutex(oracle.toplink.essentials.internal.helper.ConcurrencyManager transactionMutex)
this.transactionMutex = transactionMutex;
|
public void | setWasJTSTransactionInternallyStarted(boolean wasJTSTransactionInternallyStarted)INTERNAL:
Return if a JTS transaction was started by the session.
The session will start a JTS transaction if a unit of work or transaction is begun without a JTS transaction present.
this.wasJTSTransactionInternallyStarted = wasJTSTransactionInternallyStarted;
|
public void | severe(java.lang.String message, java.lang.String category)PUBLIC:
This method is called when a severe level message needs to be logged.
The message will be translated
log(SessionLog.SEVERE, category, message);
|
public boolean | shouldLog(int Level, java.lang.String category)PUBLIC:
Check if a message of the given level would actually be logged.
return getSessionLog().shouldLog(Level, category);
|
public boolean | shouldLogMessages()PUBLIC:
Return if logging is enabled (false if log level is OFF)
if (getLogLevel(null) == SessionLog.OFF) {
return false;
} else {
return true;
}
|
public void | startOperationProfile(java.lang.String operationName)INTERNAL:
Start the operation timing.
if (isInProfile()) {
getProfiler().startOperationProfile(operationName);
}
|
public java.lang.String | toString()Print the connection status with the session.
StringWriter writer = new StringWriter();
writer.write(getSessionTypeString() + "(" + Helper.cr() + "\t" + getAccessor() + Helper.cr() + "\t" + getDatasourcePlatform() + ")");
return writer.toString();
|
public java.lang.Object | unwrapObject(java.lang.Object proxy)INTERNAL:
Unwrap the object if required.
This is used for the wrapper policy support and EJB.
return getDescriptor(proxy).getObjectBuilder().unwrapObject(proxy, this);
|
public java.lang.Object | updateObject(java.lang.Object domainObject)PUBLIC:
Update the object and all of its privately owned parts in the database.
Update should only be used if the application knows that the object is new,
otherwise writeObject should be used.
The update operation can be customized through using an update query.
UpdateObjectQuery query = new UpdateObjectQuery();
query.setObject(domainObject);
return executeQuery(query);
|
public void | updateProfile(java.lang.String operationName, java.lang.Object value)INTERNAL:
Updates the value of SessionProfiler state
if (isInProfile()) {
getProfiler().update(operationName, value);
}
|
public void | validateQuery(oracle.toplink.essentials.queryframework.DatabaseQuery query)INTERNAL:
This method will be used to update the query with any settings required
For this session. It can also be used to validate execution.
// a no-op for this class
|
public boolean | verifyDelete(java.lang.Object domainObject)TESTING:
This is used by testing code to ensure that a deletion was successful.
ObjectBuilder builder = getDescriptor(domainObject).getObjectBuilder();
Object implementation = builder.unwrapObject(domainObject, this);
return builder.verifyDelete(implementation, this);
|
public void | warning(java.lang.String message, java.lang.String category)PUBLIC:
This method is called when a warning level message needs to be logged.
The message will be translated
log(SessionLog.WARNING, category, message);
|
public boolean | wasJTSTransactionInternallyStarted()INTERNAL:
Return if a JTS transaction was started by the session.
The session will start a JTS transaction if a unit of work or transaction is begun without a JTS transaction present.
return wasJTSTransactionInternallyStarted;
|
public java.lang.Object | wrapObject(java.lang.Object implementation)INTERNAL:
Wrap the object if required.
This is used for the wrapper policy support and EJB.
return getDescriptor(implementation).getObjectBuilder().wrapObject(implementation, this);
|
protected void | writeAllObjects(oracle.toplink.essentials.internal.helper.IdentityHashtable domainObjects)INTERNAL:
Write all of the objects and all of their privately owned parts in the database.
The allows for a group of new objects to be commited as a unit.
The objects will be commited through a single transactions and any
foreign keys/circular references between the objects will be resolved.
getCommitManager().commitAllObjects(domainObjects);
|
protected void | writeAllObjectsWithChangeSet(oracle.toplink.essentials.internal.sessions.UnitOfWorkChangeSet uowChangeSet)INTERNAL:
Write all of the objects and all of their privately owned parts in the database.
The allows for a group of new objects to be commited as a unit.
The objects will be commited through a single transactions and any
foreign keys/circular references between the objects will be resolved.
getCommitManager().commitAllObjectsWithChangeSet(uowChangeSet);
|
public java.lang.Object | writeObject(java.lang.Object domainObject)PUBLIC:
Write the object and all of its privately owned parts in the database.
Write will determine if an insert or an update should be done,
it may go to the database to determine this (by default will check the identity map).
The write operation can be customized through using an write query.
WriteObjectQuery query = new WriteObjectQuery();
query.setObject(domainObject);
return executeQuery(query);
|
public void | writesCompleted()INTERNAL:
This method notifies the accessor that a particular sets of writes has
completed. This notification can be used for such thing as flushing the
batch mechanism
getAccessor().writesCompleted(this);
|