-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
detectAlias() in QueryUtils will pick up other tokens that have "from" in them and pick the next alias from there. #2508
Comments
It appears the change to the Previous:
Current:
|
Actually, the problem isn't about the CAST at all. It's that your third test case has "from" buried in the middle of That's because |
Looking for "from" token during alias detection must be triggered by columns and other constructs that may also have "from" (e.g. :effectiveFrom binding variable). See #2508.
Looking for "from" token during alias detection must NOT be triggered by columns and other constructs that may also have "from" (e.g. :effectiveFrom binding variable). See #2508.
NOTE: Part of the issue in solving this is that many of our unit tests have Unit tests should at least have a space before |
Looking for "from" token during alias detection must NOT be triggered by columns and other constructs that may also have "from" (e.g. :effectiveFrom binding variable). See #2508.
Resolved in |
Backported to 2.7.x. |
Backported to 2.6.x. |
Backported to 2.5.x. |
@gregturn thanks for looking into this. |
In the past, a token with "from" buried in it would trip up QueryUtils. These tests further demonstrate that this is no longer an issue with the HQL parser. Related: #2508.
@markkrause-wk You may like to know, that the new HQL parser handles this with ease (latest branch of Spring Data JPA). All three scenarios now pass. I'm adding this to our test suite. (2f6955e) If you have another query to further check this out, please let us know. |
In the past, a token with "from" buried in it would trip up QueryUtils. These tests further demonstrate that this is no longer an issue with the HQL parser. Related: spring-projects#2508.
In Spring Data JPA 2.6.4 something changed in the alias detection that causes it to sometimes incorrectly determine the alias in a query that uses a cast().
For example:
from User u where (cast(:effectiveFrom as date) is null) OR :effectiveFrom >= u.createdAt
incorrectly identifies the alias to be
date
when it should beu
.Oddly it doesn't pick up on some other similar uses of cast which it has no trouble with, e.g.
where only the last assertion fails. This is similar in some ways to 2232 although in my case it's with a JPA query rather than a native query.
The text was updated successfully, but these errors were encountered: