Expected behavior
See conversation in Ebean Group.
As of version 13.6.6, queries no longer retrieve deep soft-deleted paths when multiple fetchLazy(path) are chained. This differs from
- Versions prior to 13.6.6
- and from
fetch(), which doesn't have issues with multiple fetch paths like query .setIncludeSoftDeletes().fetch("account").fetch("account.environment")
The minimal reproduction PR linked below demonstrates workarounds.
Actual behavior
// demonstrates new behaviour in 13.6.6
// when: lazy fetching serviceAccount AND serviceAccount.environment
List<UsageRaw> lazyUsageMultiplePaths = server.find(UsageRaw.class)
.setIncludeSoftDeletes()
.fetchLazy("serviceAccount")
.fetchLazy("serviceAccount.environment")
.findList();
// then: soft-deleted environments are NOT loaded (not the case before 13.6.6)
assert(lazyUsageMultiplePaths.size() == 2);
assert(lazyUsageMultiplePaths.stream().allMatch(accountLoaded()));
assert(lazyUsageMultiplePaths.stream().filter(environmentLoaded()).count() == 1);
// demonstrates workaround, use single path, all required properties are loaded
// when: lazy fetching serviceAccount.environment
List<UsageRaw> lazyUsageSinglePath = server.find(UsageRaw.class)
.setIncludeSoftDeletes()
.fetchLazy("serviceAccount.environment")
.findList();
// then: soft-deleted environments loaded
assert(lazyUsageSinglePath.size() == 2);
assert(lazyUsageSinglePath.stream().allMatch(accountLoaded()));
assert(lazyUsageSinglePath.stream().allMatch(environmentLoaded()));
// models
public class Usage {
UUID id
String name
@ManyToOne
Account account
}
public class Account {
UUID id
String name
@OneToOne
Environment environment
@SoftDelete
boolean deleted
}
public class Environment {
UUID id
String name
@SoftDelete
boolean deleted
}
Steps to reproduce
See the minimal reproduction which includes unit tests demonstrating the issue and workarounds.
Expected behavior
See conversation in Ebean Group.
As of version 13.6.6, queries no longer retrieve deep soft-deleted paths when multiple
fetchLazy(path)are chained. This differs fromfetch(), which doesn't have issues with multiple fetch paths likequery .setIncludeSoftDeletes().fetch("account").fetch("account.environment")The minimal reproduction PR linked below demonstrates workarounds.
Actual behavior
Steps to reproduce
See the minimal reproduction which includes unit tests demonstrating the issue and workarounds.