protected void test() {
    UnitOfWork uow = getSession().acquireUnitOfWork();
    ReadObjectQuery query = new ReadObjectQuery(Employee.class);
    query.setLockMode(ObjectLevelReadQuery.LOCK_NOWAIT);
    Employee emp = (Employee) uow.executeQuery(query);

    emp.setSalary(emp.getSalary() + 1);
    uow.commit();
  }
  public void test() {

    ReadObjectQuery query = new ReadObjectQuery();
    query.setReferenceClass(Employee.class);
    query.setExampleObject(employee);
    query.setQueryByExamplePolicy(policy);
    Employee emp = new Employee();
    emp = (Employee) getSession().executeQuery(query);
    if (!(emp.getFirstName().charAt(0) == 'J')
        && (emp.getFirstName().charAt(3) == 'l')
        && (emp.getLastName().charAt(0) == 'M')) {
      throw (new TestErrorException("Error in using specail operators."));
    }
    if (!(emp.getSalary() < 60000)) {
      throw (new TestErrorException("Error is using spcial operators."));
    }
  }
  public static ReadObjectTest getReadInterfaceObjectTest() {
    TestSuite suite = new TestSuite();
    PopulationManager manager = PopulationManager.getDefaultManager();
    Contact contact = ((Employee) manager.getObject(Employee.class, "example1")).getContact();

    ExpressionBuilder builder = new ExpressionBuilder();
    Expression expression = builder.get("id").equal(contact.getEmp().getId());

    ReadObjectQuery query = new ReadObjectQuery();
    query.setReferenceClass(ContactHolder.class);
    query.setSelectionCriteria(expression);

    ReadObjectTest test = new ReadObjectTest(contact.getEmp());
    test.setQuery(query);

    return test;
  }
  public void setup() {
    getSession().getIdentityMapAccessor().initializeIdentityMaps();
    getAbstractSession().beginTransaction();

    descriptor = getSession().getProject().getDescriptors().get(Employee.class);

    // Read Object
    readObjectQuery = descriptor.getQueryManager().getReadObjectQuery();
    QueryRedirector redirector =
        new MethodBaseQueryRedirector(RedirectorOnDescriptorTest.class, "readObject");
    ReadObjectQuery roq = new ReadObjectQuery(descriptor.getJavaClass());
    roq.setRedirector(redirector);
    descriptor.getQueryManager().setReadObjectQuery(roq);

    // Read All
    readAllQuery = descriptor.getQueryManager().getReadAllQuery();
    redirector = new MethodBaseQueryRedirector(RedirectorOnDescriptorTest.class, "readAll");
    ReadAllQuery raq = new ReadAllQuery(descriptor.getJavaClass());
    raq.setRedirector(redirector);
    descriptor.getQueryManager().setReadAllQuery(raq);

    // Delete Object
    deleteObjectQuery = descriptor.getQueryManager().getDeleteQuery();
    redirector = new MethodBaseQueryRedirector(RedirectorOnDescriptorTest.class, "deleteObject");
    DeleteObjectQuery doq = new DeleteObjectQuery();
    doq.setRedirector(redirector);
    descriptor.getQueryManager().setDeleteQuery(doq);

    // Insert Object
    insertQuery = descriptor.getQueryManager().getInsertQuery();
    redirector = new MethodBaseQueryRedirector(RedirectorOnDescriptorTest.class, "insertObject");
    InsertObjectQuery ioq = new InsertObjectQuery();
    ioq.setRedirector(redirector);
    descriptor.getQueryManager().setInsertQuery(ioq);

    // Update Object
    updateQuery = descriptor.getQueryManager().getUpdateQuery();
    redirector = new MethodBaseQueryRedirector(RedirectorOnDescriptorTest.class, "updateObject");
    UpdateObjectQuery uoq = new UpdateObjectQuery();
    uoq.setRedirector(redirector);
    descriptor.getQueryManager().setUpdateQuery(uoq);
  }
 public void executeUntilStopped() {
   Session session =
       ConcurrentTestRefreshWithOptimisticLocking.server.serverSession.acquireClientSession();
   DeadLockAddress address =
       (DeadLockAddress)
           session.readObject(
               org.eclipse.persistence.testing.tests.clientserver.DeadLockAddress.class);
   DeadLockEmployee employee = (DeadLockEmployee) session.readObject(DeadLockEmployee.class);
   ReadObjectQuery query;
   if ((this.index % 2) != 0) {
     query = new ReadObjectQuery(address);
     query.refreshIdentityMapResult();
     query.setCascadePolicy(DatabaseQuery.CascadeAllParts);
   } else {
     query = new ReadObjectQuery(employee);
     query.refreshIdentityMapResult();
     query.setCascadePolicy(DatabaseQuery.CascadeAllParts);
   }
   while (ConcurrentTestRefreshWithOptimisticLocking.execute) {
     ConcurrentTestRefreshWithOptimisticLocking.timeList[this.index] = System.currentTimeMillis();
     session.executeQuery(query);
   }
   // System.out.println("BeingShutDown");
 }