/** * 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); }
/** * 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) { Object object = null; if (getSession().isUnitOfWork() && (!getQuery().isReportQuery()) && (getQuery().shouldMaintainCache()) && (getQuery().isObjectLevelReadQuery())) { UnitOfWorkImpl unitOfWork = (UnitOfWorkImpl)getSession(); ObjectLevelReadQuery query = (ObjectLevelReadQuery)getQuery(); if (query.shouldConformResultsInUnitOfWork() || query.getDescriptor().shouldAlwaysConformResultsInUnitOfWork()) { object = query.conformIndividualResult(row, unitOfWork, getTranslationRow(), getSelectionCriteriaClone(), getInitiallyConformingIndex(), true); // Notifies caller to continue until conforming instance found if (object == null) { return InvalidObject.instance; } } else { // This will now automatically clone the result. object = query.buildObject(row); } } else { object = getQuery().buildObject(row); } return object; }