Methods Summary |
---|
protected java.util.List | buildObjectsFromRecords(java.util.List databaseRecords)INTERNAL:
This method is used to build the results. Interpreting the
SQLResultSetMapping.
List results = new ArrayList(databaseRecords.size() );
SQLResultSetMapping mapping = this.getSQLResultSetMapping();
for (Iterator iterator = databaseRecords.iterator(); iterator.hasNext();){
if (mapping.getResults().size()>1){
Object[] resultElement = new Object[mapping.getResults().size()];
DatabaseRecord record = (DatabaseRecord)iterator.next();
for (int i = 0;i<mapping.getResults().size();i++){
resultElement[i] = ((SQLResult)mapping.getResults().get(i)).getValueFromRecord(record, this);
}
results.add(resultElement);
}else if (mapping.getResults().size()==1) {
DatabaseRecord record = (DatabaseRecord)iterator.next();
results.add( ((SQLResult)mapping.getResults().get(0)).getValueFromRecord(record, this));
}else {
return results;
}
}
return results;
|
public java.lang.Object | clone()INTERNAL:
Clone the query.
ResultSetMappingQuery cloneQuery = (ResultSetMappingQuery)super.clone();
cloneQuery.resultSetMapping = this.resultSetMapping;
cloneQuery.resultSetMappingName = this.resultSetMappingName;
return cloneQuery;
|
public void | convertClassNamesToClasses(java.lang.ClassLoader classLoader)INTERNAL:
Convert all the class-name-based settings in this ResultSetMapping to actual class-based
settings. This method is used when converting a project that has been built
with class names to a project with classes.
resultSetMapping.convertClassNamesToClasses(classLoader);
|
public java.lang.Object | executeDatabaseQuery()INTERNAL:
Executes the prepared query on the datastore.
if (getSession().isUnitOfWork()) {
UnitOfWorkImpl unitOfWork = (UnitOfWorkImpl)getSession();
// Note if a nested unit of work this will recursively start a
// transaction early on the parent also.
if (isLockQuery()) {
if ((!unitOfWork.getCommitManager().isActive()) && (!unitOfWork.wasTransactionBegunPrematurely())) {
unitOfWork.beginTransaction();
unitOfWork.setWasTransactionBegunPrematurely(true);
}
}
if (unitOfWork.isNestedUnitOfWork()) {
// execute in parent UOW then register normally here.
UnitOfWorkImpl nestedUnitOfWork = (UnitOfWorkImpl)getSession();
setSession(nestedUnitOfWork.getParent());
Object result = executeDatabaseQuery();
setSession(nestedUnitOfWork);
Object clone = registerIndividualResult(result, unitOfWork, false, null);
if (shouldUseWrapperPolicy()) {
clone = getDescriptor().getObjectBuilder().wrapObject(clone, unitOfWork);
}
return clone;
}
}
session.validateQuery(this);// this will update the query with any settings
if (getQueryId() == 0) {
setQueryId(getSession().getNextQueryId());
}
Vector rows = getQueryMechanism().executeSelect();
setExecutionTime(System.currentTimeMillis());
// If using 1-m joins, must set all rows.
return buildObjectsFromRecords(rows);
|
public oracle.toplink.essentials.queryframework.SQLResultSetMapping | getSQLResultSetMapping()PUBLIC:
This will be the SQLResultSetMapping that is used by this query to process
the database results
if (this.resultSetMapping == null && this.resultSetMappingName != null){
this.resultSetMapping = this.getSession().getProject().getSQLResultSetMapping(this.resultSetMappingName);
}
return this.resultSetMapping;
|
public java.lang.String | getSQLResultSetMappingName()PUBLIC:
Return the result set mapping name.
return this.resultSetMappingName;
|
protected void | prepare()INTERNAL:
Prepare the receiver for execution in a session.
if ((!shouldMaintainCache()) && shouldRefreshIdentityMapResult()) {
throw QueryException.refreshNotPossibleWithoutCache(this);
}
getQueryMechanism().prepare();
getQueryMechanism().prepareExecuteSelect();
|
public void | setSQLResultSetMapping(oracle.toplink.essentials.queryframework.SQLResultSetMapping resultSetMapping)PUBLIC:
This will be the SQLResultSetMapping that is used by this query to process
the database results
this.resultSetMapping = resultSetMapping;
this.resultSetMappingName = resultSetMapping.getName();
|
public void | setSQLResultSetMappingName(java.lang.String name)PUBLIC:
This will be the SQLResultSetMapping that is used by this query to process
the database results
if (name == null && this.resultSetMapping == null){
throw new IllegalArgumentException(ExceptionLocalization.buildMessage("null_sqlresultsetmapping_in_query"));
}
this.resultSetMappingName = name;
|