spring-projects / spring-projects/spring-data-commons

findByXOrderByX: Inconsistent processing of property names and Order specs [DATACMNS-996]

Open
#1,446 0 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 30, 2020.

in: repository type: bug
Dominant language
Java
Stars
838
Forks
730
PR merge metrics
No merged PRs in 30d

Description

Vojtech Toman opened DATACMNS-996 and commented

Consider the following domain class:

class Test {
  private x;
  ...
}

and the following findBy repository method:

findByXOrderByX(...)

When this method name is parsed and converted into a PartTree (and a Sort instance), the PartTree will refer to 'X' as 'x' - but the Sort will refer to the property as 'X'. Note that this inconsistency occurs only for property names that match the pattern \[A-Z0-9._$]+ (see the implementation of PropertyPath.from()); for other property names there is no inconsistency.

This inconsistency leads to problems during query creation in our spring-data implementation (because we are unable to get the persistent property path for capital 'X' on Test when processing the Sort). We have to work around this but it would be nice if it can be fixed on the spring-data level.

We are using spring-data 1.13.0 but I suspect this issue is present in older versions as well


Affects: 1.13 GA (Ingalls)

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.