Skip to content

Commit

Permalink
TIME should be valid parameter name for JPQL queries.
Browse files Browse the repository at this point in the history
See #3093
  • Loading branch information
gregturn committed Aug 2, 2023
1 parent 34e2331 commit b5106d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ identification_variable
| OUTER
| FLOOR
| SIGN
| TIME
| TYPE
| VALUE)
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,9 +544,11 @@ public List<JpaQueryParsingToken> visitUpdate_clause(JpqlParser.Update_clauseCon

ctx.update_item().forEach(updateItemContext -> {
tokens.addAll(visit(updateItemContext));
NOSPACE(tokens);
tokens.add(TOKEN_COMMA);
});
CLIP(tokens);
SPACE(tokens);

return tokens;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -958,4 +958,13 @@ void alternateNotEqualsOperatorShouldWork() {
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
""");
}
}

0 comments on commit b5106d1

Please sign in to comment.