spring-projects / spring-projects/spring-data-commons
findByXOrderByX: Inconsistent processing of property names and Order specs [DATACMNS-996]
@odrotbohm is already working on this.
Since Dec 30, 2020.
- 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
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.
Assessment
This issue has not been assessed yet.