コード例 #1
0
 protected void changeNestedUnitOfWorkAgain2() {
   // Many to many
   nestedUnitOfWorkWorkingCopy.setProjects(new Vector());
   // Direct collection
   nestedUnitOfWorkWorkingCopy.addResponsibility("dragon boat this summer");
   // One to one private/public
   nestedUnitOfWorkWorkingCopy.setAddress(
       new org.eclipse.persistence.testing.models.employee.domain.Address());
   nestedUnitOfWorkWorkingCopy.setManager(null);
 }
コード例 #2
0
  /** Create a new employee and commit. */
  public void test() {
    employee = (Employee) getSession().readObject(Employee.class, expression);

    UnitOfWork uow = getSession().acquireUnitOfWork();
    Employee employeeClone = (Employee) uow.registerObject(employee);
    employeeClone.setSalary(employeeClone.getSalary() + 1);
    manager = new Employee();
    manager.setFirstName("Fred");
    manager.setLastName("Fenster");
    Employee managerClone = (Employee) uow.registerObject(manager);
    employeeClone.setManager(managerClone);
    uow.commit();
  }
コード例 #3
0
 protected void changeNestedUnitOfWork() {
   // Many to many
   nestedUnitOfWorkWorkingCopy.setProjects(new Vector());
   nestedUnitOfWorkWorkingCopy.addProject(
       (org.eclipse.persistence.testing.models.employee.domain.Project)
           this.nestedUnitOfWork.readObject(SmallProject.class));
   nestedUnitOfWorkWorkingCopy.addProject(
       (org.eclipse.persistence.testing.models.employee.domain.Project)
           this.nestedUnitOfWork.readObject(LargeProject.class));
   // Direct collection
   nestedUnitOfWorkWorkingCopy.setResponsibilitiesList(new Vector());
   nestedUnitOfWorkWorkingCopy.addResponsibility("does not make cafee");
   nestedUnitOfWorkWorkingCopy.addResponsibility("does not buy donuts");
   // One to one private/public
   nestedUnitOfWorkWorkingCopy.setAddress(
       new org.eclipse.persistence.testing.models.employee.domain.Address());
   nestedUnitOfWorkWorkingCopy.setManager(
       (Employee) this.nestedUnitOfWork.readObject(Employee.class));
 }