Queries no longer retrieving deep soft-deleted paths when fetchLazy are chained
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.5k
- Forks
- 267
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 5
Description
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 likequery .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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal reproduction PR and its unit tests linked in the issue, using Ebean 13.6.6 to reproduce chained fetchLazy calls with soft-deleted associations. Compare the chained paths with the single deep path and fetch() behavior. Done means both chained fetchLazy paths load the soft-deleted environment as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100