public void test() {
    // test readAll
    getSession().readAllObjects(Employee.class);
    getSession().getIdentityMapAccessor().initializeIdentityMap(Employee.class);

    // test readObject
    Employee employee =
        (Employee)
            getSession().readObject(Employee.class, new ExpressionBuilder().get("id").equal(99));

    // test delete with an employee read from the database
    employee = (Employee) getSession().readObject(Employee.class);
    try {
      getAbstractSession().deleteObject(employee);
    } catch (DatabaseException exc) {
      // if we get an integrity exception here, the query went to the DB and was not redirected
      redirectedDeleteObject = false;
    }

    UnitOfWork uow = getSession().acquireUnitOfWork();
    // test update with an employee read from the database
    employee = (Employee) uow.readObject(Employee.class);
    employee.setFirstName(employee.getFirstName() + "-changed");

    // insert an employee to test the insert behavior
    employee = new Employee();
    employee.setFirstName("Paul");
    employee.setLastName("Sheldon");
    uow.registerObject(employee);

    uow.commit();
  }
 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();
 }
  protected void test() {
    // Read in a Country.
    aCountry = (Country) uow.readObject(Country.class);
    oldName = aCountry.getName();

    // Update the country and commit. Nothing should be written to the db.
    uow.registerObject(aCountry);
    aCountry.setName(aCountry.getName() + " 22");
    uow.commit();
  }
  protected void setup() {
    beginTransaction();

    // Acquire a unit of work with a class read-only.
    Vector readOnlyClasses = new Vector();
    readOnlyClasses.addElement(Country.class);
    uow = getSession().acquireUnitOfWork();
    uow.removeAllReadOnlyClasses();
    uow.addReadOnlyClasses(readOnlyClasses);
  }
  public void test() {
    transport = Transport.example6();
    UnitOfWork uow = getSession().acquireUnitOfWork();
    uow.registerObject(transport);
    uow.commit();

    transportId = transport.getId();

    DatabaseSession session = (DatabaseSession) getSession();
    ExpressionBuilder exp = new ExpressionBuilder();
    Expression expression = exp.get("id").equal(transportId);
    transport = (Transport) session.readObject(Transport.class, expression);
  }
  public void test() {
    UnitOfWork uow = getSession().acquireUnitOfWork();
    Employee_XML emp =
        (Employee_XML)
            uow.readObject(
                Employee_XML.class, new ExpressionBuilder().get("firstName").equal("Frank"));
    Document resume = emp.resume;
    // System.out.println(resume);
    NodeList nodes = resume.getElementsByTagName("last-name");
    // System.out.println(nodes);
    Node lastName = nodes.item(0);
    Node lastNameText = lastName.getFirstChild();
    lastNameText.setNodeValue("Williams");
    emp.payroll_xml = "<payroll><salary>50000</salary><pay-period>weekly</pay-period></payroll>";

    uow.commit();
  }