Skip to content

Commit

Permalink
Add support for JPA 3.2 additions to JPQL.
Browse files Browse the repository at this point in the history
See #3136.
  • Loading branch information
gregturn committed Sep 1, 2023
1 parent 510e2da commit 9c89381
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ string_expression
| aggregate_expression
| case_expression
| function_invocation
| string_expression '||' string_expression
| '(' subquery ')'
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,11 @@ public List<JpaQueryParsingToken> visitString_expression(JpqlParser.String_expre
tokens.addAll(visit(ctx.case_expression()));
} else if (ctx.function_invocation() != null) {
tokens.addAll(visit(ctx.function_invocation()));
} else if (ctx.string_expression() != null) {

tokens.addAll(visit(ctx.string_expression(0)));
tokens.add(new JpaQueryParsingToken("||"));
tokens.addAll(visit(ctx.string_expression(1)));
} else if (ctx.subquery() != null) {

tokens.add(TOKEN_OPEN_PAREN);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1600,4 +1600,14 @@ void newShouldBeLegalAsPartOfAStateFieldPathExpression() {
ORDER BY j.id
""");
}

@Test // GH-3136
void doublePipeShouldBeValidAsAStringConcatOperator() {

assertQuery("""
select e.name || ' ' || e.title
from Employee e
""");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -983,4 +983,13 @@ void newShouldBeLegalAsPartOfAStateFieldPathExpression() {
ORDER BY j.id
""");
}

@Test // GH-3136
void doublePipeShouldBeValidAsAStringConcatOperator() {

assertQuery("""
select e.name || ' ' || e.title
from Employee e
""");
}
}

0 comments on commit 9c89381

Please sign in to comment.