public void test() {
    // stored procedure call
    StoredProcedureCall spCall = new StoredProcedureCall();
    spCall.setProcedureName("Read_All_Employees");
    spCall.useNamedCursorOutputAsResultSet("RESULT_CURSOR");

    // query
    DirectReadQuery query = new DirectReadQuery();
    query.setCall(spCall);
    query.useScrollableCursor();
    cursor = (ScrollableCursor) getSession().executeQuery(query);

    // If the driver returns a forward-only ResultSet initialized to afterLast there's nothing
    // ScrollableCursor can do with it.
    try {
      if ((cursor.getResultSet().isAfterLast())
          && (cursor.getResultSet().getType() == java.sql.ResultSet.TYPE_FORWARD_ONLY)) {
        throwWarning(
            "The ResultSet returned from the query is TYPE_FORWARD_ONLY and initialized to afterLast.");
      }
    } catch (java.sql.SQLException sqle) {
      throwWarning("Unexpected SQLException thrown while checking the ResultSet.");
    }

    // iterate the cursor
    try {
      while (cursor.hasNext()) {
        cursor.next();
      }
    } catch (org.eclipse.persistence.exceptions.DatabaseException dbe) {
      caughtException = dbe;
    } finally {
      if (cursor != null) {
        cursor.close();
      }
    }
  }
  public void test() {

    ReadAllQuery query = new ReadAllQuery();

    if (configuration != null) {
      ExpressionBuilder emp = new ExpressionBuilder();
      Expression exp = emp.get("salary").greaterThan(50000);
      query.setSelectionCriteria(exp);
      query.conformResultsInUnitOfWork();
    }
    ScrollableCursor cursor = null;

    try {
      query.setReferenceClass(Employee.class);
      if (TYPE_SCROLL_INSENSITIVE_isSupported && CONCUR_UPDATABLE_isSupported) {
        query.useScrollableCursor(2);
      } else {
        ScrollableCursorPolicy policy = new ScrollableCursorPolicy();
        if (!TYPE_SCROLL_INSENSITIVE_isSupported) {
          policy.setResultSetType(ScrollableCursorPolicy.TYPE_SCROLL_SENSITIVE);
        }
        if (!CONCUR_UPDATABLE_isSupported) {
          policy.setResultSetConcurrency(ScrollableCursorPolicy.CONCUR_READ_ONLY);
        }
        policy.setPageSize(2);
        query.useScrollableCursor(policy);
      }
      cursor = (ScrollableCursor) getSession().executeQuery(query);

      try {
        boolean isFirst = cursor.first();
        if (!cursor.isFirst() || !isFirst) {
          navigationError = "cursor.first() does not result in cursor.isFirst() returning true.";
        }
        Object second = cursor.next();
        Object first = cursor.previous();
        if (first.equals(second)) {
          navigationError = "cursor.next() and cursor.previous() are not complementary.";
        }
        if (!second.equals(cursor.next())) {
          navigationError = "cursor.next() does not move the cursor forward.";
        }
        boolean isRelative = cursor.relative(1);
        if (!isRelative || !second.equals(cursor.previous())) {
          navigationError =
              "cursor.relative() does not move the cursor the proper number of spaces.";
        }
        boolean isAbsolute = cursor.absolute(1);
        if (!second.equals(cursor.next())) {
          navigationError = "cursor.absolute(0) move a cursor to the beginning of the cursor.";
        }
        cursor.beforeFirst();
        if (!cursor.isBeforeFirst()) {
          navigationError =
              "cursor.beforeFirst() does not result in cursor.isBeforeFirst() returning true.";
        }
        if (!first.equals(cursor.next())) {
          navigationError = "cursor.beforeFirst() does not set the cursor position properly.";
        }

        boolean isLast = cursor.last();
        if (!isLast || !cursor.isLast()) {
          navigationError = "cursor.last() does not result in cursor.isLast() returning true.";
        }
        cursor.afterLast();

        if (!cursor.isAfterLast()) {
          navigationError =
              "cursor.afterLast() does not result in cursor.isAfterLast() returning true.";
        }
        Object last = cursor.previous();
        int size = cursor.size();
        cursor.relative(size);
        Object lastBySize = cursor.previous();
        if (!last.equals(lastBySize)) {
          navigationError = "The last item in the list is not correct.";
        }

      } catch (org.eclipse.persistence.exceptions.QueryException ex) {
        caughtException = ex;
      }

    } finally {
      if (cursor != null) {
        cursor.close();
      }
    }
  }
  public void test() {

    ReadAllQuery query = new ReadAllQuery();
    ScrollableCursor cursor = null;

    try {
      query.setReferenceClass(Employee.class);
      if (TYPE_SCROLL_INSENSITIVE_isSupported && CONCUR_UPDATABLE_isSupported) {
        query.useScrollableCursor(2);
      } else {
        ScrollableCursorPolicy policy = new ScrollableCursorPolicy();
        if (!TYPE_SCROLL_INSENSITIVE_isSupported) {
          policy.setResultSetType(ScrollableCursorPolicy.TYPE_SCROLL_SENSITIVE);
        }
        if (!CONCUR_UPDATABLE_isSupported) {
          policy.setResultSetConcurrency(ScrollableCursorPolicy.CONCUR_READ_ONLY);
        }
        policy.setPageSize(2);
        query.useScrollableCursor(policy);
      }
      //
      if (configuration != null) {
        ExpressionBuilder builder = new ExpressionBuilder();
        Expression exp = builder.get("salary").greaterThan(50000);
        query.setSelectionCriteria(exp);
        query.conformResultsInUnitOfWork();
      }
      cursor = (ScrollableCursor) getSession().executeQuery(query);

      try {
        // test to see if we can iterate through a list and then iterate
        // in reverse through the same list.
        int totalItems = 0;
        while (cursor.hasNext()) {
          readWithNext.addElement(cursor.next());
          totalItems++;
        }
        while (cursor.hasPrevious()) {
          readWithPrevious.addElement(cursor.previous());
          totalItems--;
        }

        cursorSuccess = (totalItems == 0);

        int size = readWithPrevious.size();
        for (int i = 0; i < readWithNext.size(); i++) {
          cursorSuccess =
              (cursorSuccess
                  && (readWithNext.elementAt(i) == readWithPrevious.elementAt((size - 1) - i)));
        }

      } catch (org.eclipse.persistence.exceptions.QueryException ex) {
        caughtException = ex;
      }

    } finally {
      if (cursor != null) {
        cursor.close();
      }
    }
  }