/** * INTERNAL: Execute the query. Get the rows and build the object from the rows. * * @exception DatabaseException - an error has occurred on the database * @return java.lang.Object collection of objects resulting from execution of query. */ protected Object executeObjectLevelReadQuery() throws DatabaseException { Object result = null; if (getContainerPolicy().overridesRead()) { return getContainerPolicy().execute(); } if (this.descriptor.isDescriptorForInterface()) { Object returnValue = this.descriptor.getInterfacePolicy().selectAllObjectsUsingMultipleTableSubclassRead(this); setExecutionTime(System.currentTimeMillis()); return returnValue; } List rows = getQueryMechanism().selectAllRows(); setExecutionTime(System.currentTimeMillis()); // If using 1-m joins, must set all rows. if (hasJoining() && this.joinedAttributeManager.isToManyJoin()) { this.joinedAttributeManager.setDataResults(rows, this.session); } if (this.session.isUnitOfWork()) { result = registerResultInUnitOfWork( rows, (UnitOfWorkImpl) this.session, this.translationRow, true); // } else { result = getContainerPolicy().containerInstance(rows.size()); this.descriptor.getObjectBuilder().buildObjectsInto(this, rows, result); } if (this.shouldIncludeData) { ComplexQueryResult complexResult = new ComplexQueryResult(); complexResult.setResult(result); complexResult.setData(rows); return complexResult; } // Add the other (already registered) results and return them. if (getDescriptor().hasTablePerClassPolicy()) { result = containerPolicy.concatenateContainers( result, getDescriptor() .getTablePerClassPolicy() .selectAllObjectsUsingMultipleTableSubclassRead(this)); } return result; }