Fix for #70 - @PrivateOwned makes Ebean try to remove non persistent objects from DB and throws OptimisticLockException

This commit is contained in:
Rob Bygrave
2014-03-15 13:48:56 +13:00
parent 5bd454bdc0
commit f0dd069ed2
2 changed files with 10 additions and 1 deletions
@@ -29,12 +29,14 @@ public class TestPrivateOwnedIgnoreTransientOrphan extends BaseTestCase {
master1 = Ebean.find(master0.getClass(), master0.getId());
// Add then remove a bean that was never saved (to the DB)
master1.getDetails().add(new TSDetail());
master1.getDetails().clear();
try{
Ebean.save(master1);
} catch (OptimisticLockException exception) {
// Occured when the "unsaved" bean was wrongly being deleted
Assert.fail("Optimistic lock exception wrongly thrown: " + exception.getMessage());
return;
}