return null; } else if ((result != null) || (!originalPolicy.isIN())) { return result; if (originalPolicy.isIN()) { batchedObjects.put(foreignKey, Helper.NULL_VALUE); } else if (batchQuery.isReadAllQuery() && ((ReadAllQuery)batchQuery).getBatchFetchPolicy().isIN()) { throw QueryException.originalQueryMustUseBatchIN(this, originalQuery);
return null; } else if ((result != null) || (!originalPolicy.isIN())) { return result; if (originalPolicy.isIN()) { batchedObjects.put(foreignKey, Helper.NULL_VALUE); } else if (batchQuery.isReadAllQuery() && ((ReadAllQuery)batchQuery).getBatchFetchPolicy().isIN()) { throw QueryException.originalQueryMustUseBatchIN(this, originalQuery);
/** * INTERNAL: * Indicates whether the query can use ResultSet optimization. * The method is called when the query is prepared, * so it should refer only to the attributes that cannot be altered without re-preparing the query. * If the query is a clone and the original has been already prepared * this method will be called to set a (transient and therefore set to null) usesResultSetAccessOptimization attribute. */ public boolean supportsResultSetAccessOptimizationOnPrepare() { DatabaseCall call = getCall(); return ((call != null) && call.getReturnsResultSet()) && // must return ResultSet (!hasJoining() || !this.joinedAttributeManager.isToManyJoin()) && (!this.descriptor.hasInheritance() || !this.descriptor.getInheritancePolicy().hasClassExtractor() && // ClassExtractor requires the whole row (shouldOuterJoinSubclasses() || !this.descriptor.getInheritancePolicy().requiresMultipleTableSubclassRead() || this.descriptor.getInheritancePolicy().hasView())) && // don't know how to handle select class type call - ResultSet optimization breaks it. (this.batchFetchPolicy == null || !this.batchFetchPolicy.isIN()); // batchFetchPolicy.isIN() requires all rows up front - can't support it }
/** * INTERNAL: * Indicates whether the query can use ResultSet optimization. * The method is called when the query is prepared, * so it should refer only to the attributes that cannot be altered without re-preparing the query. * If the query is a clone and the original has been already prepared * this method will be called to set a (transient and therefore set to null) usesResultSetAccessOptimization attribute. */ public boolean supportsResultSetAccessOptimizationOnPrepare() { DatabaseCall call = getCall(); return ((call != null) && call.getReturnsResultSet()) && // must return ResultSet (!hasJoining() || !this.joinedAttributeManager.isToManyJoin()) && (!this.descriptor.hasInheritance() || !this.descriptor.getInheritancePolicy().hasClassExtractor() && // ClassExtractor requires the whole row (shouldOuterJoinSubclasses() || !this.descriptor.getInheritancePolicy().requiresMultipleTableSubclassRead() || this.descriptor.getInheritancePolicy().hasView())) && // don't know how to handle select class type call - ResultSet optimization breaks it. (this.batchFetchPolicy == null || !this.batchFetchPolicy.isIN()); // batchFetchPolicy.isIN() requires all rows up front - can't support it }
/** * INTERNAL: * builds and registers an object from a row for cursors. * Behavior is different from the query version in that refreshing is not * supported. */ protected Object buildAndRegisterObject(AbstractRecord row) { ReadQuery query = this.query; if (query.isObjectLevelReadQuery()) { ObjectLevelReadQuery objectQuery = (ObjectLevelReadQuery)query; if (objectQuery.hasBatchReadAttributes() && objectQuery.getBatchFetchPolicy().isIN()) { objectQuery.getBatchFetchPolicy().addDataResults(row); } if (this.session.isUnitOfWork() && (!query.isReportQuery()) && query.shouldMaintainCache() && (objectQuery.shouldConformResultsInUnitOfWork() || objectQuery.getDescriptor().shouldAlwaysConformResultsInUnitOfWork())) { Object object = objectQuery.conformIndividualResult( objectQuery.buildObject(row), (UnitOfWorkImpl)this.session, this.translationRow, this.selectionCriteriaClone, this.initiallyConformingIndex); // Notifies caller to continue until conforming instance found if (object == null) { return InvalidObject.instance; } return object; } } return query.buildObject(row); }
/** * INTERNAL: * builds and registers an object from a row for cursors. * Behavior is different from the query version in that refreshing is not * supported. */ protected Object buildAndRegisterObject(AbstractRecord row) { ReadQuery query = this.query; if (query.isObjectLevelReadQuery()) { ObjectLevelReadQuery objectQuery = (ObjectLevelReadQuery)query; if (objectQuery.hasBatchReadAttributes() && objectQuery.getBatchFetchPolicy().isIN()) { objectQuery.getBatchFetchPolicy().addDataResults(row); } if (this.session.isUnitOfWork() && (!query.isReportQuery()) && query.shouldMaintainCache() && (objectQuery.shouldConformResultsInUnitOfWork() || objectQuery.getDescriptor().shouldAlwaysConformResultsInUnitOfWork())) { Object object = objectQuery.conformIndividualResult( objectQuery.buildObject(row), (UnitOfWorkImpl)this.session, this.translationRow, this.selectionCriteriaClone, this.initiallyConformingIndex); // Notifies caller to continue until conforming instance found if (object == null) { return InvalidObject.instance; } return object; } } return query.buildObject(row); }
if ((this.batchFetchPolicy != null) && this.batchFetchPolicy.isIN()) { this.batchFetchPolicy.setDataResults(rows);
if ((this.batchFetchPolicy != null) && this.batchFetchPolicy.isIN()) { this.batchFetchPolicy.setDataResults(rows);
if (row != null) { if ((this.batchFetchPolicy != null) && this.batchFetchPolicy.isIN()) { this.batchFetchPolicy.addDataResults(row);