protected void clear() {
    UnitOfWork uow = acquireUnitOfWork();

    // use alternate way for Symfoware as it doesn't support UpdateAll/DeleteAll on multi-table
    // objects (see rfe 298193)
    if (!(JUnitTestCase.getServerSession("fieldaccess")).getPlatform().isSymfoware()) {
      UpdateAllQuery updateEmployees = new UpdateAllQuery(Employee.class);
      updateEmployees.addUpdate("manager", null);
      updateEmployees.addUpdate("address", null);
      uow.executeQuery(updateEmployees);

      uow.executeQuery(new DeleteAllQuery(Employee.class));
    } else {
      Iterator<Employee> emps = uow.readAllObjects(Employee.class).iterator();
      while (emps.hasNext()) {
        Employee emp = emps.next();
        emp.setManager(null);
        emp.setAddress(null);
        uow.deleteObject(emp);
      }
      ;
    }

    UpdateAllQuery updateProjects = new UpdateAllQuery(Project.class);
    updateProjects.addUpdate("teamLeader", null);
    uow.executeQuery(updateProjects);

    uow.executeQuery(new DeleteAllQuery(PhoneNumber.class));
    uow.executeQuery(new DeleteAllQuery(Address.class));
    uow.executeQuery(new DeleteAllQuery(Project.class));

    uow.commit();
    dbSessionClearCache();
  }
 public void reset() {
   // Remove the transport added for this test
   DatabaseSession session = (DatabaseSession) getSession();
   UnitOfWork uow = session.acquireUnitOfWork();
   ExpressionBuilder transport = new ExpressionBuilder();
   Expression expression = transport.get("id").equal(transportId);
   uow.deleteAllObjects(uow.readAllObjects(Transport.class, expression));
   uow.commit();
 }
  public void test() {
    UnitOfWork uow = getSession().acquireUnitOfWork();
    Vector allDepts = uow.readAllObjects(Dept.class);
    Dept cloneDept = (Dept) allDepts.get(0);
    this.initialSize = cloneDept.getEmpCollection().size();

    Dept deptToEdit = (Dept) allDepts.get(0);
    Iterator empIter = deptToEdit.getEmpCollection().iterator();
    empIter.next();
    Emp empToEdit = (Emp) empIter.next();
    empToEdit.setEname("whatever");

    uow.revertAndResume();
    Vector allDeptsAgain = uow.readAllObjects(Dept.class);
    cloneDept = (Dept) allDepts.get(0);
    if (cloneDept.getEmpCollection().size() != this.initialSize) {
      throw new TestErrorException(
          "Revert cause duplicates to be entered in relationship maintenanced collection");
    }
  }
 public void test() {
   UnitOfWork uow = getSession().acquireUnitOfWork();
   holders = uow.readAllObjects(DirectAggregateMapHolder.class, holderExp);
   changedHolder = (DirectAggregateMapHolder) holders.get(0);
   changedHolder.removeDirectToAggregateMapItem(new Integer(1));
   AggregateMapValue mapValue = new AggregateMapValue();
   mapValue.setValue(3);
   changedHolder.addDirectToAggregateMapItem(new Integer(3), mapValue);
   uow.commit();
   Object holderForComparison = uow.readObject(changedHolder);
   if (!compareObjects(changedHolder, holderForComparison)) {
     throw new TestErrorException("Objects do not match after write");
   }
 }