mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Fix for #70 - @PrivateOwned makes Ebean try to remove non persistent objects from DB and throws OptimisticLockException
This commit is contained in:
@@ -764,7 +764,14 @@ public final class DefaultPersister implements Persister {
|
||||
// increase depth for batching order
|
||||
t.depth(+1);
|
||||
for (Object removedBean : modifyRemovals) {
|
||||
deleteRecurse(removedBean, t);
|
||||
if (removedBean instanceof EntityBean) {
|
||||
EntityBean eb = (EntityBean)removedBean;
|
||||
if (eb._ebean_getIntercept().isLoaded()) {
|
||||
// only delete if the bean was loaded meaning that
|
||||
// it is know to exist in the DB
|
||||
deleteRecurse(removedBean, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
t.depth(-1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user