/**
   * INTERNAL: Build a row representation from the ADT structure field array. TopLink will then
   * build the object from the row.
   */
  public AbstractRecord buildRowFromStructure(Struct structure) throws DatabaseException {
    Object[] attributes;
    try {
      attributes = structure.getAttributes();
    } catch (java.sql.SQLException exception) {
      throw DatabaseException.sqlException(exception);
    }

    if (attributes != null) {
      for (int i = 0; i < attributes.length; i++) {
        if (attributes[i] instanceof Array) {
          attributes[i] =
              ObjectRelationalDataTypeDescriptor.buildArrayObjectFromArray(attributes[i]);
        } else if (attributes[i] instanceof Struct) {
          attributes[i] =
              ObjectRelationalDataTypeDescriptor.buildArrayObjectFromStruct(attributes[i]);
        }
      }
    }

    return buildNestedRowFromFieldValue(attributes);
  }