/** * INTERNAL: * Select one row of any concrete subclass, * This must use two selects, the first retrieves the type field only. */ protected AbstractRecord selectOneRowUsingDefaultMultipleTableSubclassRead(ReadObjectQuery query) throws DatabaseException, QueryException { // Get the row for the given class indicator field // The indicator select is prepared in the original query, so can just be executed. AbstractRecord typeRow = ((ExpressionQueryMechanism)query.getQueryMechanism()).selectOneRowFromTable(); if (typeRow == null) { return null; } Class concreteClass = classFromRow(typeRow, query.getSession()); ClassDescriptor concreteDescriptor = getDescriptor(concreteClass); if (concreteDescriptor == null) { throw QueryException.noDescriptorForClassFromInheritancePolicy(query, concreteClass); } ReadObjectQuery concreteQuery = (ReadObjectQuery)query.clone(); concreteQuery.setReferenceClass(concreteClass); concreteQuery.setDescriptor(concreteDescriptor); AbstractRecord resultRow = ((ExpressionQueryMechanism)concreteQuery.getQueryMechanism()).selectOneRowFromConcreteTable(); return resultRow; }
/** * INTERNAL: * Select one row of any concrete subclass, * This must use two selects, the first retrieves the type field only. */ protected AbstractRecord selectOneRowUsingDefaultMultipleTableSubclassRead(ReadObjectQuery query) throws DatabaseException, QueryException { // Get the row for the given class indicator field // The indicator select is prepared in the original query, so can just be executed. AbstractRecord typeRow = ((ExpressionQueryMechanism)query.getQueryMechanism()).selectOneRowFromTable(); if (typeRow == null) { return null; } Class concreteClass = classFromRow(typeRow, query.getSession()); ClassDescriptor concreteDescriptor = getDescriptor(concreteClass); if (concreteDescriptor == null) { throw QueryException.noDescriptorForClassFromInheritancePolicy(query, concreteClass); } ReadObjectQuery concreteQuery = (ReadObjectQuery)query.clone(); concreteQuery.setReferenceClass(concreteClass); concreteQuery.setDescriptor(concreteDescriptor); AbstractRecord resultRow = ((ExpressionQueryMechanism)concreteQuery.getQueryMechanism()).selectOneRowFromConcreteTable(); return resultRow; }
/** * INTERNAL: * Select one row of any concrete subclass, * This must use two selects, the first retrieves the type field only. */ protected AbstractRecord selectOneRowUsingDefaultMultipleTableSubclassRead(ReadObjectQuery query) throws DatabaseException, QueryException { // Get the row for the given class indicator field // The indicator select is prepared in the original query, so can just be executed. AbstractRecord typeRow = ((ExpressionQueryMechanism)query.getQueryMechanism()).selectOneRowFromTable(); if (typeRow == null) { return null; } Class concreteClass = classFromRow(typeRow, query.getSession()); ClassDescriptor concreteDescriptor = getDescriptor(concreteClass); if (concreteDescriptor == null) { throw QueryException.noDescriptorForClassFromInheritancePolicy(query, concreteClass); } ReadObjectQuery concreteQuery = (ReadObjectQuery)query.clone(); concreteQuery.setReferenceClass(concreteClass); concreteQuery.setDescriptor(concreteDescriptor); AbstractRecord resultRow = ((ExpressionQueryMechanism)concreteQuery.getQueryMechanism()).selectOneRowFromConcreteTable(); return resultRow; }
/** * INTERNAL: * Select one rows from a abstract table descriptor. * This is accomplished by selecting for all of the concrete classes until a row is found. * This does not optimize using type select, as the type information is not known. * @exception DatabaseException - an error has occurred on the database. */ protected AbstractRecord selectOneRowUsingCustomMultipleTableSubclassRead(ReadObjectQuery query) throws DatabaseException { // CR#3701077, it must either have a filter only instances expression, or not have subclasses. // This method recurses, so even though this is only called when shouldReadSubclasses is true, it may be false for subclasses. if ((getOnlyInstancesExpression() != null) || (! shouldReadSubclasses())) { ReadObjectQuery concreteQuery = (ReadObjectQuery)query.clone(); concreteQuery.setReferenceClass(getDescriptor().getJavaClass()); concreteQuery.setDescriptor(getDescriptor()); AbstractRecord row = ((ExpressionQueryMechanism)concreteQuery.getQueryMechanism()).selectOneRowFromConcreteTable(); if (row != null) { return row; } } // Recursively collect all rows from all concrete children and their children. for (Enumeration childrenEnum = getChildDescriptors().elements(); childrenEnum.hasMoreElements();) { ClassDescriptor concreteDescriptor = (ClassDescriptor)childrenEnum.nextElement(); AbstractRecord row = concreteDescriptor.getInheritancePolicy().selectOneRowUsingCustomMultipleTableSubclassRead(query); if (row != null) { return row; } } return null; }
List rows = getQueryMechanism().selectAllRows(); if (rows.size() > 0) { row = (AbstractRecord)rows.get(0); row = getQueryMechanism().selectOneRow();
/** * INTERNAL: * Select one rows from a abstract table descriptor. * This is accomplished by selecting for all of the concrete classes until a row is found. * This does not optimize using type select, as the type information is not known. * @exception DatabaseException - an error has occurred on the database. */ protected AbstractRecord selectOneRowUsingCustomMultipleTableSubclassRead(ReadObjectQuery query) throws DatabaseException { // CR#3701077, it must either have a filter only instances expression, or not have subclasses. // This method recurses, so even though this is only called when shouldReadSubclasses is true, it may be false for subclasses. if ((getOnlyInstancesExpression() != null) || (! shouldReadSubclasses())) { ReadObjectQuery concreteQuery = (ReadObjectQuery)query.clone(); concreteQuery.setReferenceClass(getDescriptor().getJavaClass()); concreteQuery.setDescriptor(getDescriptor()); AbstractRecord row = ((ExpressionQueryMechanism)concreteQuery.getQueryMechanism()).selectOneRowFromConcreteTable(); if (row != null) { return row; } } // Recursively collect all rows from all concrete children and their children. for (ClassDescriptor concreteDescriptor : getChildDescriptors()) { AbstractRecord row = concreteDescriptor.getInheritancePolicy().selectOneRowUsingCustomMultipleTableSubclassRead(query); if (row != null) { return row; } } return null; }
/** * INTERNAL: * Select one rows from a abstract table descriptor. * This is accomplished by selecting for all of the concrete classes until a row is found. * This does not optimize using type select, as the type information is not known. * @exception DatabaseException - an error has occurred on the database. */ protected AbstractRecord selectOneRowUsingCustomMultipleTableSubclassRead(ReadObjectQuery query) throws DatabaseException { // CR#3701077, it must either have a filter only instances expression, or not have subclasses. // This method recurses, so even though this is only called when shouldReadSubclasses is true, it may be false for subclasses. if ((getOnlyInstancesExpression() != null) || (! shouldReadSubclasses())) { ReadObjectQuery concreteQuery = (ReadObjectQuery)query.clone(); concreteQuery.setReferenceClass(getDescriptor().getJavaClass()); concreteQuery.setDescriptor(getDescriptor()); AbstractRecord row = ((ExpressionQueryMechanism)concreteQuery.getQueryMechanism()).selectOneRowFromConcreteTable(); if (row != null) { return row; } } // Recursively collect all rows from all concrete children and their children. for (ClassDescriptor concreteDescriptor : getChildDescriptors()) { AbstractRecord row = concreteDescriptor.getInheritancePolicy().selectOneRowUsingCustomMultipleTableSubclassRead(query); if (row != null) { return row; } } return null; }
getQueryMechanism().prepareSelectAllRows(); } else { getQueryMechanism().prepareSelectOneRow();
getQueryMechanism().prepareSelectAllRows(); } else { getQueryMechanism().prepareSelectOneRow();
getQueryMechanism().prepareSelectAllRows(); } else { getQueryMechanism().prepareSelectOneRow();
List rows = getQueryMechanism().selectAllRows(); if (rows.size() > 0) { row = (AbstractRecord)rows.get(0); row = getQueryMechanism().selectOneRow();
List rows = getQueryMechanism().selectAllRows(); if (rows.size() > 0) { row = (AbstractRecord)rows.get(0); row = getQueryMechanism().selectOneRow();
&& (!(session.isRemoteSession() && (shouldRefreshRemoteIdentityMapResult() || this.descriptor.shouldDisableCacheHitsOnRemote()))) && (!(shouldCheckDescriptorForCacheUsage() && this.descriptor.shouldDisableCacheHits())) && (!this.descriptor.isDescriptorForInterface())) { Object cachedObject = getQueryMechanism().checkCacheForObject(translationRow, session);
&& (!(session.isRemoteSession() && (shouldRefreshRemoteIdentityMapResult() || this.descriptor.shouldDisableCacheHitsOnRemote()))) && (!(shouldCheckDescriptorForCacheUsage() && this.descriptor.shouldDisableCacheHits())) && (!this.descriptor.isDescriptorForInterface())) { Object cachedObject = getQueryMechanism().checkCacheForObject(translationRow, session); this.isCacheCheckComplete = true;
&& (!(session.isRemoteSession() && (shouldRefreshRemoteIdentityMapResult() || this.descriptor.shouldDisableCacheHitsOnRemote()))) && (!(shouldCheckDescriptorForCacheUsage() && this.descriptor.shouldDisableCacheHits())) && (!this.descriptor.isDescriptorForInterface())) { Object cachedObject = getQueryMechanism().checkCacheForObject(translationRow, session); this.isCacheCheckComplete = true;