/** * PUBLIC: * Retrieve the size of the open cursor by executing a count on the same query as the cursor. * * If this cursor is conforming size() can only be an estimate. cursor size * plus number of conforming instances found in memory will be returned. The * union (actual result) may be smaller than this. */ public int size() throws DatabaseException { if (size == -1) { size = getCursorSize(); if (getInitiallyConformingIndex() != null) { size += getInitiallyConformingIndex().size(); } } return size; } }
/** * 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; }