result = this.template.get(emp.getClass());
assertTrue(result.isEmpty());
}
public void testExecuteCallback() {
EmployeeImpl emp1 = new EmployeeImpl("a1");
EmployeeImpl emp2 = new EmployeeImpl("a2");
this.template.save(emp1);
this.template.save(emp2);
assertNull(emp1.getFirstname());
assertNull(emp1.getSurname());
// Execute a callback which looks for a1 and update it:
PrevaylerCallback callback = new SimpleSearchAndUpdatePrevaylerCallback();
// The callback execution returns a list of one employee:
List result = (List) this.template.execute(callback);
assertEquals(1, result.size());
// Get it:
emp1 = (EmployeeImpl) result.get(0);
// Verify the update:
assertTrue(emp1.getFirstname().equals("Sergio"));
assertTrue(emp1.getSurname().equals("Bossa"));
// Verify it is the same as the one directly retrieved from the prevalent system:
EmployeeImpl emp1_1 = (EmployeeImpl) this.template.get(Employee.class, emp1.getId());
assertSame(emp1, emp1_1);
}