use of org.eclipse.persistence.testing.models.employee.domain.Address in project eclipselink by eclipse-ee4j.
the class NestedUnitOfWorkMultipleCommitTest method changeNestedUnitOfWorkAgain.
protected void changeNestedUnitOfWorkAgain() {
// Many to many
nestedUnitOfWorkWorkingCopy.setProjects(new Vector());
// Direct collection
nestedUnitOfWorkWorkingCopy.addResponsibility("eat not buy donuts");
// One to one private/public
nestedUnitOfWorkWorkingCopy.setAddress(new Address());
nestedUnitOfWorkWorkingCopy.setManager(null);
}
use of org.eclipse.persistence.testing.models.employee.domain.Address in project eclipselink by eclipse-ee4j.
the class NestedUnitOfWorkReadOnlyClassTest method test.
@Override
public void test() {
getSession().getIdentityMapAccessor().initializeAllIdentityMaps();
// start root transaction
UnitOfWork rootUOW = getSession().acquireUnitOfWork();
Address addressRO = (Address) getSession().readObject(Address.class, new ExpressionBuilder().get("postalCode").equal(postalCode));
if (addressRO == null) {
throw new TestErrorException("Unable to find address.");
}
// start nested transaction
UnitOfWork nestedUOW = rootUOW.acquireUnitOfWork();
nestedUOW.addReadOnlyClass(Address.class);
Employee emp = (Employee) nestedUOW.registerObject(new Employee());
nestedUOW.assignSequenceNumber(emp);
emp.setFirstName("John");
emp.setAddress(addressRO);
nestedUOW.commit();
rootUOW.commit();
originalEmployee = emp;
}
use of org.eclipse.persistence.testing.models.employee.domain.Address in project eclipselink by eclipse-ee4j.
the class NestedUnitOfWorkTest method changeUnitOfWorkWorkingCopy.
protected void changeUnitOfWorkWorkingCopy() {
Employee employee = (Employee) this.unitOfWorkWorkingCopy;
// Transformation
employee.setNormalHours(new java.sql.Time[2]);
employee.setStartTime(Helper.timeFromHourMinuteSecond(1, 1, 1));
employee.setEndTime(Helper.timeFromHourMinuteSecond(1, 1, 1));
// Aggregate
employee.setPeriod(new EmploymentPeriod(Helper.dateFromYearMonthDate(1901, 1, 1), Helper.dateFromYearMonthDate(1902, 2, 2)));
// One to many private
employee.setPhoneNumbers(new Vector());
employee.addPhoneNumber(new PhoneNumber("home", "613", "2263374"));
employee.addPhoneNumber(new PhoneNumber("office", "416", "8224599"));
// Many to many
employee.setProjects(new Vector());
employee.addProject((Project) this.unitOfWork.readObject(SmallProject.class));
employee.addProject((Project) this.unitOfWork.readObject(LargeProject.class));
// Direct collection
employee.setResponsibilitiesList(new Vector());
employee.addResponsibility("make coffee");
employee.addResponsibility("buy donuts");
// One to one private/public
employee.setAddress(new Address());
// make sure that the employee is not his own manager
employee.setManager((Employee) this.unitOfWork.readObject(Employee.class, (new ExpressionBuilder()).get("id").notEqual(employee.getId())));
}
use of org.eclipse.persistence.testing.models.employee.domain.Address in project eclipselink by eclipse-ee4j.
the class NLSEmployeePopulator method addressExample2.
public Address addressExample2() {
Address address = new Address();
address.setCity("\u305d\u30c8\u30c8\u30a2\u30cc\u30a2");
address.setPostalCode("K5J2B5");
address.setProvince("\u305d\u305b\u3068");
address.setStreet("12 \u3059\u30aa\u30c4\u30b1\u30cb\u30a2\u30b7 \u3064\u30a8., \u30c6\u30ca\u30b1\u30c8\u30aa 5");
address.setCountry("\u3046\u30a2\u30bb\u30a2\u30a8\u30a2");
return address;
}
use of org.eclipse.persistence.testing.models.employee.domain.Address in project eclipselink by eclipse-ee4j.
the class NLSEmployeePopulator method addressExample5.
public Address addressExample5() {
Address address = new Address();
address.setCity("\u306b\u30a2\u30bb\u30a6\u30db\u30ca\u30cb\u30aa\u30c4");
address.setPostalCode("N5J2N5");
address.setProvince("\u3044\u3046");
address.setStreet("1111 \u3059\u30db\u30ca\u30bb\u30c8\u30a2\u30b1\u30bb \u3044\u30b7\u30cb\u30a8. \u304b\u30b7\u30db\u30db\u30c4 53, \u30c6\u30ca\u30b1\u30c8\u30aa 6");
address.setCountry("\u3046\u30a2\u30bb\u30a2\u30a8\u30a2");
return address;
}
Aggregations