TIME should be valid parameter name for JPQL queries.

See #3093
This commit is contained in:
Greg L. Turnquist
2023-08-02 14:20:44 -05:00
parent 34e2331190
commit b5106d1ada
3 changed files with 12 additions and 0 deletions

View File

@@ -606,6 +606,7 @@ identification_variable
| OUTER
| FLOOR
| SIGN
| TIME
| TYPE
| VALUE)
;

View File

@@ -544,9 +544,11 @@ class JpqlQueryRenderer extends JpqlBaseVisitor<List<JpaQueryParsingToken>> {
ctx.update_item().forEach(updateItemContext -> {
tokens.addAll(visit(updateItemContext));
NOSPACE(tokens);
tokens.add(TOKEN_COMMA);
});
CLIP(tokens);
SPACE(tokens);
return tokens;
}

View File

@@ -958,4 +958,13 @@ class JpqlQueryRendererTests {
void dateAndFromShouldBeValidNames() {
assertQuery("SELECT e FROM Entity e WHERE e.embeddedId.date BETWEEN :from AND :to");
}
@Test // GH-3092
void timeShouldBeAValidParameterName() {
assertQuery("""
UPDATE Lock L
SET L.isLocked = TRUE, L.forceUnlockTime = :forceUnlockTime
WHERE L.isLocked = FALSE OR L.forceUnlockTime < :time
""");
}
}