#1568 - @OneToMany with orphanRemoval=true ... with @Cache (and not a @ManyToOne) doesn't remove orphans after cache hit

This commit is contained in:
rob bygrave
2018-11-30 23:46:11 +13:00
parent 6d5e0c4766
commit 315b39813b
4 changed files with 175 additions and 1 deletions
@@ -344,7 +344,7 @@ class SaveManyBeans extends SaveManyBase {
for (Object removedBean : modifyRemovals) {
if (removedBean instanceof EntityBean) {
EntityBean eb = (EntityBean) removedBean;
if (eb._ebean_getIntercept().isLoaded()) {
if (!eb._ebean_getIntercept().isNew()) {
// only delete if the bean was loaded meaning that it is known to exist in the DB
persister.deleteRequest(persister.createPublishRequest(removedBean, transaction, PersistRequest.Type.DELETE, request.getFlags()));
}