spring-projects / spring-projects/spring-data-relational

Embedded objects are mostly ignored in QBE queries

Open
#2,099 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: enhancement
Dominant language
Java
Stars
827
Forks
394
PR merge metrics
No merged PRs in 30d

Description

When investigating the #1986, I discovered that the embedded objects are not even considered during QBE to CriteriaDefinition conversion.

Here is the sample repo (MRE) that demonstrates the problem, the very specific test.

In the example, the ignoreCase setting is ignored. Other settings like the null handling for embedded properties described in #1986 are ignored as well.

The reason why it happens is that the algorithm in the RelationalQueryMapper only considers direct properties of an aggregate, meaning the property.getName() of direct properties is analyzed, but not deeper not recursive.

So the problem is far deeper, I'll handle it myself as well.

CC: @schauder @mp911de

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproducing test in EnclosingClassRepositoryTest.java from the linked sample repository, then read RelationalExampleMapper.java around the aggregate-property handling described in the issue. Verify how embedded properties are represented during QBE-to-CriteriaDefinition conversion. Done means the embedded object's ignoreCase and other probe settings are no longer ignored and the specific test passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.