“Floor” (and likely other reserved identifiers) cannot be used as entity name or entity field name in custom queries #2982
Labels
in: query-parser
Everything related to parsing JPQL or SQL
type: regression
A regression from a previous release
Milestone
Affected version: Spring Data 2023.0.0
Given 2 entities
Floor
andRoom
And given 2 JPA repositories with some custom queries
When using Spring Data 2023.0.0 (Spring Boot 3.1.0) invoking either custom query repository method fails.
Invoking
FloorRepository.findAllByName(String)
fails with:Invoking
RoomRepository.findAllByFloorName(String)
fails with:With Spring Data 2022.0.6 (Spring Boot 3.0.7) neither of these failures occurs.
According to the JPA Query Language specification, “floor” is a reserved identifier. As far as I understand the specification that prohibits
FROM Floor floor
andJOIN r.floor floor
but it does not prohibitFROM Floor f
andJOIN r.floor f
. The specification even contains an example where a reserved identifier (“order”) is used for an entity name:After renaming
Floor
toFloorEntity
andRoom.floor
toRoom.floorEntity
in above example, both custom queries do execute successfully.This is possibly related to #2814 (commit 0d8c06d).
jpql-floor.zip contains a minimal reproducible example.
The text was updated successfully, but these errors were encountered: