// Create and save the manager:
ManagerImpl man1 = new ManagerImpl("m1");
this.template.save(man1);
// Create an employee and add it to the manager:
EmployeeImpl emp1 = new EmployeeImpl("a1");
man1.addManagedEmployee(emp1);
// Update the manager:
this.template.update(man1);
// Get the employee from the manager and change employee firstname:
emp1 = (EmployeeImpl) man1.getManagedEmployees().iterator().next();
emp1.setFirstname("Sergio");
// Update the manager and the employee by cascade:
this.template.update(man1);
// Verify:
emp1 = (EmployeeImpl) this.template.get(Employee.class, emp1.getId());
assertEquals("Sergio", emp1.getFirstname());
}