コード例 #1
0
  /** 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;
  }
コード例 #2
0
  /**
   * 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;
  }