Methods Summary |
---|
public void | addQuery(java.lang.String name, oracle.toplink.essentials.queryframework.DatabaseQuery query)PUBLIC:
Add the query to the descriptor queries with the given name
query.setName(name);
addQuery(query);
|
public synchronized void | addQuery(oracle.toplink.essentials.queryframework.DatabaseQuery query)PUBLIC:
Add the query to the session queries
if (query instanceof ObjectLevelReadQuery && (((ObjectLevelReadQuery)query).getReferenceClassName() == null)) {
((ObjectLevelReadQuery)query).setReferenceClassName(getDescriptor().getJavaClassName());
// try to set the reference ClassNotFoundException since it should only happen on the MW in which
// case we will lazily initialize the reference class at a later point.
try {
((ObjectLevelReadQuery)query).setReferenceClass(getDescriptor().getJavaClass());
} catch (ConversionException exception) {
}
//this is an optimization
query.setDescriptor(getDescriptor());
}
// Add query has been synchronized for bug 3355199.
// Additionally code has been added to ensure that the same query is not added twice.
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);
} else {
int argumentTypesSize = 0;
if (query.getArguments() != null) {
argumentTypesSize = query.getArguments().size();
}
Vector argumentTypes = oracle.toplink.essentials.internal.helper.NonSynchronizedVector.newInstance(argumentTypesSize);
for (int i = 0; i < argumentTypesSize; i++) {
argumentTypes.addElement(query.getArgumentTypeNames().elementAt(i));
}
// Search for a query with the same parameters and replace it if one is found
for (int i = 0; i < queriesByName.size(); i++) {
DatabaseQuery currentQuery = (DatabaseQuery)queriesByName.elementAt(i);
// Here we are checking equality instead of assignability. If you look at getQuery()
// it is the other way around.
// The reason we do this is we are replacing a query and we want to make sure we are
// replacing the exact same one. - TW
if (argumentTypes.equals(currentQuery.getArgumentTypeNames())) {
queriesByName.remove(i);
queriesByName.add(i, query);
return;
}
}
}
queriesByName.add(query);
|
public void | assumeExistenceForDoesExist()PUBLIC:
Assume that if the objects primary key does not include null then it must exist.
This may be used if the application guarantees or does not care about the existence check.
getDoesExistQuery().assumeExistenceForDoesExist();
|
public void | assumeNonExistenceForDoesExist()PUBLIC:
Assume that the object does not exist. This may be used if the application guarantees or
does not care about the existence check. This will always force an insert to be called.
getDoesExistQuery().assumeNonExistenceForDoesExist();
|
public void | checkCacheForDoesExist()PUBLIC:
Default behavior.
Assume that if the objects primary key does not include null and it
is in the cache, then is must exist.
getDoesExistQuery().checkCacheForDoesExist();
|
public void | checkDatabaseForDoesExist()PUBLIC:
Perform does exist check on the database
getDoesExistQuery().checkDatabaseForDoesExist();
|
public java.lang.Object | clone()INTERNAL:
Clone the query manager
DescriptorQueryManager manager = null;
try {
manager = (DescriptorQueryManager)super.clone();
} catch (Exception exception) {
;
}
// Bug 3037701 - clone the queries
manager.setQueries(new Hashtable(getQueries().size()));
Iterator iterator = queries.values().iterator();
while (iterator.hasNext()) {
Iterator queriesForKey = ((Vector)iterator.next()).iterator();
while (queriesForKey.hasNext()) {
DatabaseQuery initialQuery = (DatabaseQuery)queriesForKey.next();
DatabaseQuery clonedQuery = (DatabaseQuery)initialQuery.clone();
clonedQuery.setDescriptor(manager.getDescriptor());
manager.addQuery(clonedQuery);
}
}
manager.setDoesExistQuery((DoesExistQuery)getDoesExistQuery().clone());
if (getReadAllQuery() != null) {
manager.setReadAllQuery((ReadAllQuery)getReadAllQuery().clone());
}
if (getReadObjectQuery() != null) {
manager.setReadObjectQuery((ReadObjectQuery)getReadObjectQuery().clone());
}
if (getUpdateQuery() != null) {
manager.setUpdateQuery((UpdateObjectQuery)getUpdateQuery().clone());
}
if (getInsertQuery() != null) {
manager.setInsertQuery((InsertObjectQuery)getInsertQuery().clone());
}
if (getDeleteQuery() != null) {
manager.setDeleteQuery((DeleteObjectQuery)getDeleteQuery().clone());
}
return manager;
|
public boolean | containsQuery(java.lang.String queryName)PUBLIC:
Return true if the query is defined on the session
return queries.containsKey(queryName);
|
public void | convertClassNamesToClasses(java.lang.ClassLoader classLoader)INTERNAL:
Convert all the class-name-based settings in this Query Manager to actual class-based
settings
This method is implemented by subclasses as necessary.
Iterator queryVectors = getQueries().values().iterator();
while (queryVectors.hasNext()){
Iterator queries = ((Vector)queryVectors.next()).iterator();;
while (queries.hasNext()){
((DatabaseQuery)queries.next()).convertClassNamesToClasses(classLoader);
}
}
|
public oracle.toplink.essentials.expressions.Expression | getAdditionalJoinExpression()ADVANCED:
Returns the join expression that should be appended to all of the descriptors expressions
Contains any multiple table or inheritance dependencies
return additionalJoinExpression;
|
public java.util.Vector | getAllQueries()PUBLIC:
Return the pre-defined queries for the descriptor. The Vector returned
contains all queries for this descriptor.
Vector allQueries = new Vector();
for (Iterator vectors = getQueries().values().iterator(); vectors.hasNext();) {
allQueries.addAll((Vector)vectors.next());
}
return allQueries;
|
public oracle.toplink.essentials.queryframework.Call | getDeleteCall()ADVANCED:
Return the receiver's delete call.
This allows the user to override the delete operation.
if (getDeleteQuery() == null) {
return null;
}
return getDeleteQuery().getDatasourceCall();
|
public oracle.toplink.essentials.queryframework.DeleteObjectQuery | getDeleteQuery()ADVANCED:
Return the receiver's delete query.
This should be an instance of a valid subclass of DeleteObjectQuery.
If specified this is used by the descriptor to delete itself and its private parts from the database.
This gives the user the ability to define exactly how to delete the data from the database,
or access data external from the database or from some other framework.
return deleteQuery;
|
public java.lang.String | getDeleteSQLString()ADVANCED:
Return the receiver's delete SQL string.
This allows the user to override the SQL generated by TopLink, with their own SQL or procedure call.
The arguments are translated from the fields of the source row,
through replacing the field names marked by '#' with the values for those fields.
Example, "delete from EMPLOYEE where EMPLOYEE_ID = #EMPLOYEE_ID".
if (getDeleteQuery() == null) {
return null;
}
return getDeleteQuery().getSQLString();
|
protected oracle.toplink.essentials.descriptors.ClassDescriptor | getDescriptor()INTERNAL:
Return the descriptor associated with this descriptor query manager
return descriptor;
|
public oracle.toplink.essentials.queryframework.Call | getDoesExistCall()ADVANCED:
Return the receiver's does-exist call.
This allows the user to override the does-exist operation.
if (getDoesExistQuery() == null) {
return null;
}
return getDoesExistQuery().getDatasourceCall();
|
public oracle.toplink.essentials.queryframework.DoesExistQuery | getDoesExistQuery()ADVANCED:
Return the receiver's does exist query.
This should be an instance of a valid subclass of DoesExistQuery.
If specified this is used by the descriptor to query existence of an object in the database.
This gives the user the ability to define exactly how to query existence from the database,
or access data external from the database or from some other framework.
return doesExistQuery;
|
public java.lang.String | getDoesExistSQLString()ADVANCED:
Return the receiver's does exist SQL string.
This allows the user to override the SQL generated by TopLink, with there own SQL or procedure call.
The arguments are translated from the fields of the source row, through replacing the field names marked by '#'
with the values for those fields.
This must return null if the object does not exist, otherwise return a database row.
Example, "select EMPLOYEE_ID from EMPLOYEE where EMPLOYEE_ID = #EMPLOYEE_ID".
if (getDoesExistQuery() == null) {
return null;
}
return getDoesExistQuery().getSQLString();
|
public java.lang.String | getExistenceCheck()INTERNAL:
This method is explicitly used by the Builder only.
if (getDoesExistQuery().shouldAssumeExistenceForDoesExist()) {
return "Assume existence";
} else if (getDoesExistQuery().shouldAssumeNonExistenceForDoesExist()) {
return "Assume non-existence";
} else if (getDoesExistQuery().shouldCheckCacheForDoesExist()) {
return "Check cache";
} else if (getDoesExistQuery().shouldCheckDatabaseForDoesExist()) {
return "Check database";
} else {
// Default.
return "Check cache";
}
|
public oracle.toplink.essentials.queryframework.Call | getInsertCall()ADVANCED:
Return the receiver's insert call.
This allows the user to override the insert operation.
if (getInsertQuery() == null) {
return null;
}
return getInsertQuery().getDatasourceCall();
|
public oracle.toplink.essentials.queryframework.InsertObjectQuery | getInsertQuery()ADVANCED:
Return the receiver's insert query.
This should be an instance of a valid subclass of InsertObjectQuery.
If specified this is used by the descriptor to insert itself into the database.
If the receiver uses sequence numbers, this query must return the updated sequence value.
This gives the user the ability to define exactly how to insert the data into the database,
or access data externel from the database or from some other framework.
return insertQuery;
|
public java.lang.String | getInsertSQLString()ADVANCED:
Return the receiver's insert SQL string.
This allows the user to override the SQL generated by TopLink, with their own SQL or procedure call.
The arguments are translated from the fields of the source row,
through replacing the field names marked by '#' with the values for those fields.
Example, "insert into EMPLOYEE (F_NAME, L_NAME) values (#F_NAME, #L_NAME)".
if (getInsertQuery() == null) {
return null;
}
return getInsertQuery().getSQLString();
|
public oracle.toplink.essentials.queryframework.DatabaseQuery | getLocalQuery(java.lang.String name, java.util.Vector arguments)INTENAL:
Return the query from the set of pre-defined queries with the given name and argument types.
This allows for common queries to be pre-defined, reused and executed by name.
Only returns those queries locally defined, not superclass's queries
If only one query exists, it will be returned regardless of the arguments.
If multiple queries exist, the first query that has corresponding argument types will be returned
Vector queries = (Vector)getQueries().get(name);
if (queries == null){
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 = oracle.toplink.essentials.internal.helper.NonSynchronizedVector.newInstance(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();
// BUG#2698755
// This check was backward, we default the type to Object
// Was checking Object is decendent of String not other way.
if (Helper.areTypesAssignable(query.getArgumentTypes(), argumentTypes)) {
return query;
}
}
return null;
|
public oracle.toplink.essentials.expressions.Expression | getMultipleTableJoinExpression()ADVANCED:
This is normally generated for descriptors that have multiple tables.
However, if the additional table does not reference the primary tables primary key,
this expression may be set directly.
return multipleTableJoinExpression;
|
public oracle.toplink.essentials.descriptors.DescriptorQueryManager | getParentDescriptorQueryManager()INTERNAL:
Get the parent DescriptorQueryManager.
Caution must be used in using this method as it expects the descriptor
to have inheritance.
Calling this when the descriptor that does not use inheritance will cause problems, #hasInheritance() must
always first be called.
return getDescriptor().getInheritancePolicy().getParentDescriptor().getQueryManager();
|
public java.util.Map | getQueries()PUBLIC:
Return the pre-defined queries for the descriptor. The Hashtable returned
contains Vectors of queries.
return queries;
|
public oracle.toplink.essentials.queryframework.DatabaseQuery | getQuery(java.lang.String queryName)PUBLIC:
Return the query name from the set of pre-defined queries
If only one query exists with this name, it will be returned.
If there are multiple queries of this name, this method will search for a query
with no arguments and return the first one it finds.
return getQuery(queryName, null);
|
public oracle.toplink.essentials.queryframework.DatabaseQuery | getQuery(java.lang.String name, java.util.Vector arguments)PUBLIC:
Return the query from the set of 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.
If only one query exists, it will be returned regardless of the arguments.
If multiple queries exist, the first query that has corresponding argument types will be returned
DatabaseQuery query = getLocalQuery(name, arguments);
// CR#3711: Check if a query with the same name exists for this descriptor.
// If not, recursively check descriptors of parent classes. If nothing is
// found in parents, return null.
if (query == null) {
DatabaseQuery parentQuery = getQueryFromParent(name, arguments);
if (parentQuery != null && parentQuery.isReadQuery()) {
parentQuery = (DatabaseQuery) parentQuery.clone();
((ObjectLevelReadQuery)parentQuery).setReferenceClass(getDescriptor().getJavaClass());
addQuery(name, parentQuery);
}
return parentQuery;
}
return query;
|
protected oracle.toplink.essentials.queryframework.DatabaseQuery | getQueryFromParent(java.lang.String name, java.util.Vector arguments)INTERNAL:
CR#3711: Check if the class for this descriptor has a parent class.
Then search this parent's descriptor for a query with the same name
and arguments. If nothing found, return null.
This method should only be used recursively by getQuery().
ClassDescriptor descriptor = getDescriptor();
if (descriptor.hasInheritance()) {
InheritancePolicy inheritancePolicy = descriptor.getInheritancePolicy();
ClassDescriptor parent = inheritancePolicy.getParentDescriptor();
// if parent exists, check for the query
if (parent != null) {
return parent.getQueryManager().getQuery(name, arguments);
}
}
return null;
|
public oracle.toplink.essentials.queryframework.Call | getReadAllCall()ADVANCED:
Return the receiver's read-all call.
This allows the user to override the read-all operation.
if (getReadAllQuery() == null) {
return null;
}
return getReadAllQuery().getDatasourceCall();
|
public oracle.toplink.essentials.queryframework.ReadAllQuery | getReadAllQuery()ADVANCED:
Return the receiver's read query.
This should be an instance of a valid subclass of ReadAllQuery.
return readAllQuery;
|
public java.lang.String | getReadAllSQLString()ADVANCED:
Return the receiver's read SQL string.
This allows the user to override the SQL generated by TopLink, with their own SQL or procedure call.
The arguments are translated from the fields of the read arguments row,
through replacing the field names marked by '#' with the values for those fields.
Note that this is only used on readAllObjects(Class), and not when an expression is provided.
Example, "select * from EMPLOYEE"
if (getReadAllQuery() == null) {
return null;
}
return getReadAllQuery().getSQLString();
|
public oracle.toplink.essentials.queryframework.Call | getReadObjectCall()ADVANCED:
Return the receiver's read-object call.
This allows the user to override the read-object operation.
if (getReadObjectQuery() == null) {
return null;
}
return getReadObjectQuery().getDatasourceCall();
|
public oracle.toplink.essentials.queryframework.ReadObjectQuery | getReadObjectQuery()ADVANCED:
Return the receiver's read query.
This should be an instance of a valid subclass of ReadObjectQuery.
If specified this is used by the descriptor to read itself from the database.
The read arguments must be the primary key of the object only.
This gives the user the ability to define exactly how to read the object from the database,
or access data externel from the database or from some other framework.
return readObjectQuery;
|
public java.lang.String | getReadObjectSQLString()ADVANCED:
Return the receiver's read SQL string.
This allows the user to override the SQL generated by TopLink, with their own SQL or procedure call.
The arguments are translated from the fields of the read arguments row,
through replacing the field names marked by '#' with the values for those fields.
This must accept only the primary key of the object as arguments.
Example, "select * from EMPLOYEE where EMPLOYEE_ID = #EMPLOYEE_ID"
if (getReadObjectQuery() == null) {
return null;
}
return getReadObjectQuery().getSQLString();
|
public java.util.Map | getTablesJoinExpressions()INTERNAL:
Used in case descriptor has additional tables:
each additional table mapped to an expression joining it.
if(tablesJoinExpressions == null) {
tablesJoinExpressions = new HashMap();
}
return tablesJoinExpressions;
|
public oracle.toplink.essentials.queryframework.Call | getUpdateCall()ADVANCED:
Return the receiver's update call.
This allows the user to override the update operation.
if (getUpdateQuery() == null) {
return null;
}
return getUpdateQuery().getDatasourceCall();
|
public oracle.toplink.essentials.queryframework.UpdateObjectQuery | getUpdateQuery()ADVANCED:
Return the receiver's update query.
This should be an instance of a valid subclass of UpdateObjectQuery.
If specified this is used by the descriptor to insert itself into the database.
If the receiver uses optimisitic locking this must raise an error on optimisitic lock failure.
This gives the user the ability to define exactly how to update the data into the database,
or access data externel from the database or from some other framework.
return updateQuery;
|
public java.lang.String | getUpdateSQLString()ADVANCED:
Return the receiver's update SQL string.
This allows the user to override the SQL generated by TopLink, with there own SQL or procedure call.
The arguments are translated from the fields of the source row,
through replacing the field names marked by '#' with the values for those fields.
This must check the optimistic lock field and raise an error on optimistic lock failure.
Example, "update EMPLOYEE set F_NAME to #F_NAME, L_NAME to #L_NAME where EMPLOYEE_ID = #EMPLOYEE_ID".
if (getUpdateQuery() == null) {
return null;
}
return getUpdateQuery().getSQLString();
|
public boolean | hasCustomMultipleTableJoinExpression()INTERNAL:
Return if a cutsom join expression is used.
return hasCustomMultipleTableJoinExpression;
|
public boolean | hasDeleteQuery()INTERNAL:
Flag that specifies if a delete query is available
return (deleteQuery != null);
|
public boolean | hasDoesExistQuery()INTERNAL:
Flag that specifies if a does exist query is available
return (doesExistQuery != null);
|
public boolean | hasInsertQuery()INTERNAL:
Flag that specifies if a insert query is available
return (insertQuery != null);
|
public boolean | hasReadAllQuery()INTERNAL:
Flag that specifies if a read all query is available
return (readAllQuery != null);
|
public boolean | hasReadObjectQuery()INTERNAL:
Flag that specifies if a read object query is available
return (readObjectQuery != null);
|
public boolean | hasUpdateQuery()INTERNAL:
Flag that specifies if a update query is available
return (updateQuery != null);
|
public void | initialize(oracle.toplink.essentials.internal.sessions.AbstractSession session)INTERNAL:
Post initialize the mappings
if (getDescriptor().isAggregateDescriptor()) {
return;
}
if (getMultipleTableJoinExpression() != null) {
// Combine new multiple table expression to additional join expression
setAdditionalJoinExpression(getMultipleTableJoinExpression().and(getAdditionalJoinExpression()));
}
if (getDescriptor().isAggregateCollectionDescriptor()) {
return;
}
//PERF: set read-object query to cache generated SQL.
if (!hasReadObjectQuery()) {
// Prepare static read object query always.
ReadObjectQuery readObjectQuery = new ReadObjectQuery();
readObjectQuery.setSelectionCriteria(getDescriptor().getObjectBuilder().getPrimaryKeyExpression());
setReadObjectQuery(readObjectQuery);
}
if (!hasInsertQuery()) {
// Prepare insert query always.
setInsertQuery(new InsertObjectQuery());
}
getInsertQuery().setModifyRow(getDescriptor().getObjectBuilder().buildTemplateInsertRow(session));
if (!hasDeleteQuery()) {
// Prepare delete query always.
setDeleteQuery(new DeleteObjectQuery());
}
getDeleteQuery().setModifyRow(new DatabaseRecord());
if (hasUpdateQuery()) {
// Do not prepare to update by default to allow minimal update.
getUpdateQuery().setModifyRow(getDescriptor().getObjectBuilder().buildTemplateUpdateRow(session));
}
|
private void | populateQueries()INTERNAL:
populate the queries with the descriptor.
/* CR2260
* Descriptiron:
* NullPointerException accessing null descriptor
* Fix:
* Initialize queries with an instantiated descriptor at this point
*/
if (getInsertQuery() != null) {
getInsertQuery().setDescriptor(descriptor);
}
if (getUpdateQuery() != null) {
getUpdateQuery().setDescriptor(descriptor);
}
if (getReadObjectQuery() != null) {
getReadObjectQuery().setReferenceClass(getDescriptor().getJavaClass());
getReadObjectQuery().setDescriptor(descriptor);
}
if (getDeleteQuery() != null) {
getDeleteQuery().setDescriptor(descriptor);
}
if (getReadAllQuery() != null) {
getReadAllQuery().setReferenceClass(getDescriptor().getJavaClass());
getReadAllQuery().setDescriptor(descriptor);
}
for (Iterator it = getAllQueries().iterator(); it.hasNext();) {
((DatabaseQuery)it.next()).setDescriptor(descriptor);
}
|
public void | postDelete(oracle.toplink.essentials.queryframework.WriteObjectQuery query)INTERNAL:
Execute the post delete operation for the query
// PERF: Avoid synchronized enumerator as is concurrency bottleneck.
Vector mappings = getDescriptor().getMappings();
for (int index = 0; index < mappings.size(); index++) {
((DatabaseMapping)mappings.get(index)).postDelete(query);
}
|
public void | postInsert(oracle.toplink.essentials.queryframework.WriteObjectQuery query)INTERNAL:
Execute the post insert operation for the query
// PERF: Avoid synchronized enumerator as is concurrency bottleneck.
Vector mappings = getDescriptor().getMappings();
for (int index = 0; index < mappings.size(); index++) {
((DatabaseMapping)mappings.get(index)).postInsert(query);
}
|
public void | postUpdate(oracle.toplink.essentials.queryframework.WriteObjectQuery query)INTERNAL:
Execute the post update operation for the query
// PERF: Avoid synchronized enumerator as is concurrency bottleneck.
Vector mappings = getDescriptor().getMappings();
for (int index = 0; index < mappings.size(); index++) {
((DatabaseMapping)mappings.get(index)).postUpdate(query);
}
|
public void | preDelete(oracle.toplink.essentials.queryframework.WriteObjectQuery query)INTERNAL:
Execute the pre delete operation for the query
// PERF: Avoid synchronized enumerator as is concurrency bottleneck.
Vector mappings = getDescriptor().getMappings();
for (int index = 0; index < mappings.size(); index++) {
((DatabaseMapping)mappings.get(index)).preDelete(query);
}
|
public void | preInitialize(oracle.toplink.essentials.internal.sessions.AbstractSession session)INTERNAL:
Initialize the query manager.
Any custom queries must be inherited from the parent before any initialization.
if (getDescriptor().isAggregateDescriptor()) {
return;
}
// Must inherit parent query customization if not redefined.
if (getDescriptor().isChildDescriptor()) {
DescriptorQueryManager parentQueryManager = getDescriptor().getInheritancePolicy().getParentDescriptor().getQueryManager();
if ((!hasInsertQuery()) && (parentQueryManager.hasInsertQuery())) {
setInsertQuery((InsertObjectQuery)parentQueryManager.getInsertQuery().clone());
}
if ((!hasUpdateQuery()) && (parentQueryManager.hasUpdateQuery())) {
setUpdateQuery((UpdateObjectQuery)parentQueryManager.getUpdateQuery().clone());
}
if ((!hasDeleteQuery()) && (parentQueryManager.hasDeleteQuery())) {
setDeleteQuery((DeleteObjectQuery)parentQueryManager.getDeleteQuery().clone());
}
if ((!hasReadObjectQuery()) && (parentQueryManager.hasReadObjectQuery())) {
setReadObjectQuery((ReadObjectQuery)parentQueryManager.getReadObjectQuery().clone());
}
if ((!hasReadAllQuery()) && (parentQueryManager.hasReadAllQuery())) {
setReadAllQuery((ReadAllQuery)parentQueryManager.getReadAllQuery().clone());
}
if ((!getDoesExistQuery().isUserDefined()) && getDoesExistQuery().shouldCheckCacheForDoesExist()) {
setDoesExistQuery(((DoesExistQuery)parentQueryManager.getDoesExistQuery().clone()));
}
}
|
public void | preInsert(oracle.toplink.essentials.queryframework.WriteObjectQuery query)INTERNAL:
Execute the pre insert operation for the query.
// PERF: Avoid synchronized enumerator as is concurrency bottleneck.
Vector mappings = getDescriptor().getMappings();
for (int index = 0; index < mappings.size(); index++) {
((DatabaseMapping)mappings.get(index)).preInsert(query);
}
|
public void | preUpdate(oracle.toplink.essentials.queryframework.WriteObjectQuery query)INTERNAL:
Execute the pre update operation for the query
// PERF: Avoid synchronized enumerator as is concurrency bottleneck.
Vector mappings = getDescriptor().getMappings();
for (int index = 0; index < mappings.size(); index++) {
((DatabaseMapping)mappings.get(index)).preUpdate(query);
}
|
public void | removeQuery(java.lang.String queryName)PUBLIC:
Remove all queries with the given query name from the set of pre-defined queries
queries.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);
}
}
|
public void | setAdditionalJoinExpression(oracle.toplink.essentials.expressions.Expression additionalJoinExpression)ADVANCED:
Set the additional join expression. Used in conjuction with
multiple tables and inheritance relationships.
This can also be used if a sub-expression is always required to be
appended to all queries. Such as tables that are shared based on a type field
without inheritance.
this.additionalJoinExpression = additionalJoinExpression;
|
public void | setAllQueries(java.util.Vector vector)INTERNAL:
Set pre-defined queries for the descriptor. Converts the Vector to a hashtable
for (Enumeration enumtr = vector.elements(); enumtr.hasMoreElements();) {
addQuery((DatabaseQuery)enumtr.nextElement());
}
|
public void | setDeleteCall(oracle.toplink.essentials.queryframework.Call call)ADVANCED:
Set the receiver's delete call.
This allows the user to override the delete operation.
if (call == null) {
return;
}
DeleteObjectQuery query = new DeleteObjectQuery();
query.setCall(call);
setDeleteQuery(query);
|
public void | setDeleteQuery(oracle.toplink.essentials.queryframework.DeleteObjectQuery query)ADVANCED:
Set the receiver's delete query.
This should be an instance of a valid subclas of DeleteObjectQuery.
If specified this is used by the descriptor to delete itself and its private parts from the database.
This gives the user the ability to define exactly how to delete the data from the database,
or access data external from the database or from some other framework.
this.deleteQuery = query;
if (query == null) {
return;
}
this.deleteQuery.setIsUserDefined(true);
this.deleteQuery.setDescriptor(getDescriptor());
|
public void | setDeleteSQLString(java.lang.String sqlString)ADVANCED:
Set the receiver's delete SQL string.
This allows the user to override the SQL generated by TopLink, with their own SQL or procedure call.
The arguments are translated from the fields of the source row,
through replacing the field names marked by '#' with the values for those fields.
Example, "delete from EMPLOYEE where EMPLOYEE_ID = #EMPLOYEE_ID".
if (sqlString == null) {
return;
}
DeleteObjectQuery query = new DeleteObjectQuery();
query.setSQLString(sqlString);
setDeleteQuery(query);
|
public void | setDescriptor(oracle.toplink.essentials.descriptors.ClassDescriptor descriptor)INTERNAL:
Set the descriptor.
this.descriptor = descriptor;
//Gross alert: This is for the case when we are reading from XML, and
//we have to compensate for no descriptor available at read time. - JL
populateQueries();
|
public void | setDoesExistCall(oracle.toplink.essentials.queryframework.Call call)ADVANCED:
Set the receiver's does exist call.
This allows the user to override the does exist operation.
if (call == null) {
return;
}
getDoesExistQuery().setCall(call);
|
public void | setDoesExistQuery(oracle.toplink.essentials.queryframework.DoesExistQuery query)ADVANCED:
Set the receiver's does exist query.
This should be an instance of a valid subclas of DoesExistQuery.
If specified this is used by the descriptor to query existence of an object in the database.
This gives the user the ability to define exactly how to query existence from the database,
or access data external from the database or from some other framework.
this.doesExistQuery = query;
if (query == null) {
return;
}
this.doesExistQuery.setIsUserDefined(true);
this.doesExistQuery.setDescriptor(getDescriptor());
|
public void | setDoesExistSQLString(java.lang.String sqlString)ADVANCED:
Set the receiver's does exist SQL string.
This allows the user to override the SQL generated by TopLink, with there own SQL or procedure call.
The arguments are translated from the fields of the source row, through replacing the field names marked by '#'
with the values for those fields.
This must return null if the object does not exist, otherwise return a database row.
Example, "select EMPLOYEE_ID from EMPLOYEE where EMPLOYEE_ID = #EMPLOYEE_ID".
if (sqlString == null) {
return;
}
getDoesExistQuery().setSQLString(sqlString);
getDoesExistQuery().checkDatabaseForDoesExist();
|
public void | setExistenceCheck(java.lang.String token)INTERNAL:
This method is explicitly used by the Builder only.
if (token.equals("Check cache")) {
checkCacheForDoesExist();
} else if (token.equals("Check database")) {
checkDatabaseForDoesExist();
} else if (token.equals("Assume existence")) {
assumeExistenceForDoesExist();
} else if (token.equals("Assume non-existence")) {
assumeNonExistenceForDoesExist();
} else {
throw DescriptorException.setExistenceCheckingNotUnderstood(token, getDescriptor());
}
|
protected void | setHasCustomMultipleTableJoinExpression(boolean hasCustomMultipleTableJoinExpression)INTENAL:
Set if a cutsom join expression is used.
this.hasCustomMultipleTableJoinExpression = hasCustomMultipleTableJoinExpression;
|
public void | setInsertCall(oracle.toplink.essentials.queryframework.Call call)ADVANCED:
Set the receiver's insert call.
This allows the user to override the insert operation.
if (call == null) {
return;
}
InsertObjectQuery query = new InsertObjectQuery();
query.setCall(call);
setInsertQuery(query);
|
public void | setInsertQuery(oracle.toplink.essentials.queryframework.InsertObjectQuery insertQuery)ADVANCED:
Set the receiver's insert query.
This should be an instance of a valid subclass of InsertObjectQuery.
If specified this is used by the descriptor to insert itself into the database.
This gives the user the ability to define exactly how to insert the data into the database,
or access data external from the database or from some other framework.
this.insertQuery = insertQuery;
if (insertQuery == null) {
return;
}
this.insertQuery.setIsUserDefined(true);
this.insertQuery.setDescriptor(getDescriptor());
|
public void | setInsertSQLString(java.lang.String sqlString)ADVANCED:
Set the receiver's insert SQL string.
This allows the user to override the SQL generated by TopLink, with their own SQL or procedure call.
The arguments are translated from the fields of the source row,
through replacing the field names marked by '#' with the values for those fields.
Example, "insert into EMPLOYEE (F_NAME, L_NAME) values (#F_NAME, #L_NAME)".
if (sqlString == null) {
return;
}
InsertObjectQuery query = new InsertObjectQuery();
query.setSQLString(sqlString);
setInsertQuery(query);
|
public void | setInternalMultipleTableJoinExpression(oracle.toplink.essentials.expressions.Expression multipleTableJoinExpression)INTERNAL:
Used to set the multiple table join expression that was generated by TopLink as opposed
to a custom one supplied by the user.
this.multipleTableJoinExpression = multipleTableJoinExpression;
|
public void | setMultipleTableJoinExpression(oracle.toplink.essentials.expressions.Expression multipleTableJoinExpression)ADVANCED:
This is normally generated for descriptors that have multiple tables.
However, if the additional table does not reference the primary table's primary key,
this expression may be set directly.
this.multipleTableJoinExpression = multipleTableJoinExpression;
setHasCustomMultipleTableJoinExpression(true);
|
public void | setQueries(java.util.Map hashtable)PUBLIC:
set the pre-defined queries for the descriptor. Used to write out deployment XML
queries = hashtable;
|
public void | setReadAllCall(oracle.toplink.essentials.queryframework.Call call)ADVANCED:
Set the receiver's read all call.
This allows the user to override the read all operation.
Note that this is only used on readAllObjects(Class), and not when an expression is provided.
if (call == null) {
return;
}
ReadAllQuery query = new ReadAllQuery();
query.setCall(call);
setReadAllQuery(query);
|
public void | setReadAllQuery(oracle.toplink.essentials.queryframework.ReadAllQuery query)ADVANCED:
Set the receiver's read all query.
This should be an instance of a valid subclass of ReadAllQuery.
If specified this is used by the descriptor to read all instances of its class from the database.
This gives the user the ability to define exactly how to read all objects from the database,
or access data external from the database or from some other framework.
Note that this is only used on readAllObjects(Class), and not when an expression is provided.
this.readAllQuery = query;
if (query == null) {
return;
}
this.readAllQuery.setIsUserDefined(true);
/* CR2260 - Steven Vo
* Description:
* NullPointerException accessing null descriptor
* Fix:
* Setting query's descriptor and reference class when descriptor is not null.
* Otherwise, wait until the descriptor is set.See populateQueries() that is
* called by setDescriptor()
*/
if (this.getDescriptor() != null) {
this.readAllQuery.setDescriptor(getDescriptor());
this.readAllQuery.setReferenceClassName(getDescriptor().getJavaClassName());
try {
readAllQuery.setReferenceClass(getDescriptor().getJavaClass());
} catch (ConversionException exception) {
}
}
|
public void | setReadAllSQLString(java.lang.String sqlString)ADVANCED:
Set the receiver's read SQL string.
This allows the user to override the SQL generated by TopLink, with their own SQL or procedure call.
The arguments are translated from the fields of the read arguments row,
through replacing the field names marked by '#' with the values for those fields.
Note that this is only used on readAllObjects(Class), and not when an expression is provided.
Example, "select * from EMPLOYEE"
if (sqlString == null) {
return;
}
ReadAllQuery query = new ReadAllQuery();
query.setSQLString(sqlString);
setReadAllQuery(query);
|
public void | setReadObjectCall(oracle.toplink.essentials.queryframework.Call call)ADVANCED:
Set the receiver's read object call.
This allows the user to override the read object operation.
This must accept only the primary key of the object as arguments.
if (call == null) {
return;
}
ReadObjectQuery query = new ReadObjectQuery();
query.setCall(call);
setReadObjectQuery(query);
|
public void | setReadObjectQuery(oracle.toplink.essentials.queryframework.ReadObjectQuery query)ADVANCED:
Set the receiver's read query.
This should be an instance of a valid subclass of ReadObjectQuery>
If specified this is used by the descriptor to read itself from the database.
The read arguments must be the primary key of the object only.
This gives the user the ability to define exactly how to read the object from the database,
or access data external from the database or from some other framework.
this.readObjectQuery = query;
if (query == null) {
return;
}
this.readObjectQuery.setIsUserDefined(true);
/* CR2260 - Steven Vo
* Description:
* NullPointerException accessing null descriptor
* Fix:
* Setting query's descriptor and reference class when descriptor is not null.
* Otherwise, wait until the descriptor is set.See populateQueries() that is
* called by setDescriptor()
*/
if (this.getDescriptor() != null) {
this.readObjectQuery.setDescriptor(getDescriptor());
this.readObjectQuery.setReferenceClassName(getDescriptor().getJavaClassName());
try {
readObjectQuery.setReferenceClass(getDescriptor().getJavaClass());
} catch (ConversionException exception) {
}
}
|
public void | setReadObjectSQLString(java.lang.String sqlString)ADVANCED:
Set the receiver's read SQL string.
This allows the user to override the SQL generated by TopLink, with their own SQL or procedure call.
The arguments are translated from the fields of the read arguments row,
through replacing the field names marked by '#' with the values for those fields.
This must accept only the primary key of the object as arguments.
Example, "select * from EMPLOYEE where EMPLOYEE_ID = #EMPLOYEE_ID"
if (sqlString == null) {
return;
}
ReadObjectQuery query = new ReadObjectQuery();
query.setSQLString(sqlString);
setReadObjectQuery(query);
|
public void | setUpdateCall(oracle.toplink.essentials.queryframework.Call call)ADVANCED:
Set the receiver's update call.
This allows the user to override the update operation.
if (call == null) {
return;
}
UpdateObjectQuery query = new UpdateObjectQuery();
query.setCall(call);
setUpdateQuery(query);
|
public void | setUpdateQuery(oracle.toplink.essentials.queryframework.UpdateObjectQuery updateQuery)ADVANCED:
Set the receiver's update query.
This should be an instance of a valid subclass of UpdateObjectQuery.
If specified this is used by the descriptor to update itself in the database.
If the receiver uses optimisitic locking this must raise an error on optimisitic lock failure.
This gives the user the ability to define exactly how to update the data into the database,
or access data external from the database or from some other framework.
this.updateQuery = updateQuery;
if (updateQuery == null) {
return;
}
this.updateQuery.setIsUserDefined(true);
this.updateQuery.setDescriptor(getDescriptor());
|
public void | setUpdateSQLString(java.lang.String sqlString)ADVANCED:
Set the receiver's update SQL string.
This allows the user to override the SQL generated by TopLink, with there own SQL or procedure call.
The arguments are translated from the fields of the source row,
through replacing the field names marked by '#' with the values for those fields.
This must check the optimistic lock field and raise an error on optimistic lock failure.
Example, "update EMPLOYEE set F_NAME to #F_NAME, L_NAME to #L_NAME where EMPLOYEE_ID = #EMPLOYEE_ID".
if (sqlString == null) {
return;
}
UpdateObjectQuery query = new UpdateObjectQuery();
query.setSQLString(sqlString);
setUpdateQuery(query);
|