List<?> allObjects = context.performQuery(new SelectQuery(
SimpleLockingTestEntity.class));
assertEquals(1, allObjects.size());
SimpleLockingTestEntity object = (SimpleLockingTestEntity) allObjects.get(0);
// change description and save... no optimistic lock failure expected...
object.setDescription("first update");
context.commitChanges();
// change row underneath, change description and save... optimistic lock failure
// expected
createSimpleLockUpdate();
object.setDescription("second update");
try {
context.commitChanges();
fail("Optimistic lock failure expected.");
}