/** INTERNAL: Select all objects for a concrete descriptor. */ protected Object selectAllObjects(ReadAllQuery query) { ReadAllQuery concreteQuery = (ReadAllQuery) query.deepClone(); concreteQuery.setReferenceClass(descriptor.getJavaClass()); concreteQuery.setDescriptor(descriptor); // Avoid cloning the query again ... concreteQuery.setIsExecutionClone(true); concreteQuery .getExpressionBuilder() .setQueryClassAndDescriptor(descriptor.getJavaClass(), descriptor); // Update the selection criteria if needed as well and don't lose // the translation row. if (concreteQuery.getQueryMechanism().getSelectionCriteria() != null) { // make sure query builder is used for the selection criteria as deepClone will create // two separate builders. concreteQuery.setSelectionCriteria( concreteQuery .getQueryMechanism() .getSelectionCriteria() .rebuildOn(concreteQuery.getExpressionBuilder())); return query.getSession().executeQuery(concreteQuery, query.getTranslationRow()); } return query.getSession().executeQuery(concreteQuery); }
/** INTERNAL: Select one object of any concrete subclass. */ public Object selectOneObjectUsingMultipleTableSubclassRead(ReadObjectQuery query) throws DatabaseException, QueryException { Object object = null; for (Enumeration childDescriptors = getChildDescriptors().elements(); childDescriptors.hasMoreElements() && (object == null); ) { ClassDescriptor descriptor = (ClassDescriptor) childDescriptors.nextElement(); object = descriptor.getInterfacePolicy().selectOneObject(query); } return object; }
/** INTERNAL: Select one object of any concrete subclass. */ protected Object selectOneObject(ReadObjectQuery query) throws DescriptorException { ReadObjectQuery concreteQuery = (ReadObjectQuery) query.clone(); Class javaClass = descriptor.getJavaClass(); concreteQuery.setReferenceClass(javaClass); concreteQuery.setDescriptor(descriptor); return query.getSession().executeQuery(concreteQuery, concreteQuery.getTranslationRow()); }
/** * INTERNAL: Select all objects for an interface descriptor. This is accomplished by selecting for * all of the concrete classes and then merging the objects. * * @return Vector containing all objects. * @exception DatabaseException - an error has occurred on the database. */ public Object selectAllObjectsUsingMultipleTableSubclassRead(ReadAllQuery query) throws DatabaseException { org.eclipse.persistence.internal.queries.ContainerPolicy containerPolicy = query.getContainerPolicy(); Object objects = containerPolicy.containerInstance(1); for (Enumeration childDescriptors = getChildDescriptors().elements(); childDescriptors.hasMoreElements(); ) { ClassDescriptor descriptor = (ClassDescriptor) childDescriptors.nextElement(); objects = containerPolicy.concatenateContainers( objects, descriptor.getInterfacePolicy().selectAllObjects(query)); } return objects; }