#2750 #2751 SoftDeleted entity included via lazy loading (Jackson serialisation)

The effective fix is in DLoadContext, only allow includeSoftDeletes to be set from
the query when the query is SpiQuery.Mode.NORMAL (not a lazy loading query).
This commit is contained in:
Rob Bygrave
2022-07-27 22:25:10 +12:00
parent 7a6d91c2f4
commit 0100d024d9
2 changed files with 2 additions and 2 deletions
@@ -199,7 +199,7 @@ final class DefaultBeanLoader {
query.setLazyLoadProperty(ebi.getLazyLoadProperty());
if (draft) {
query.asDraft();
} else if (mode == SpiQuery.Mode.LAZYLOAD_BEAN) {
} else if (mode == SpiQuery.Mode.LAZYLOAD_BEAN && desc.isSoftDelete()) {
query.setIncludeSoftDeletes();
}
if (embeddedOwnerIndex > -1) {
@@ -101,7 +101,7 @@ public final class DLoadContext implements LoadContext {
this.useDocStore = query.isUseDocStore();
this.asOf = query.getAsOf();
this.asDraft = query.isAsDraft();
this.includeSoftDeletes = query.isIncludeSoftDeletes();
this.includeSoftDeletes = query.isIncludeSoftDeletes() && query.getMode() == SpiQuery.Mode.NORMAL;
this.readOnly = query.isReadOnly();
this.disableReadAudit = query.isDisableReadAudit();
this.disableLazyLoading = query.isDisableLazyLoading();