File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
main/java/org/springframework/data/jpa/repository/query
test/java/org/springframework/data/jpa/repository/query Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -100,8 +100,13 @@ public QueryRendererBuilder visitFromQuery(HqlParser.FromQueryContext ctx) {
100100
101101 if (ctx .fromClause () != null ) {
102102 builder .appendExpression (visit (ctx .fromClause ()));
103+ if (primaryFromAlias == null ) {
104+ builder .append (TOKEN_AS );
105+ builder .append (TOKEN_DOUBLE_UNDERSCORE );
106+ }
103107 }
104108
109+
105110 if (ctx .whereClause () != null ) {
106111 builder .appendExpression (visit (ctx .whereClause ()));
107112 }
Original file line number Diff line number Diff line change @@ -919,11 +919,11 @@ void queryParserPicksCorrectAliasAmidstMultipleAlises() {
919919 assertThat (alias ("select u from User as u left join u.roles as r" )).isEqualTo ("u" );
920920 }
921921
922- @ Test // GH-2032
922+ @ Test // GH-2032, GH-3792
923923 void countQueryShouldWorkEvenWithoutExplicitAlias () {
924924
925925 assertCountQuery ("FROM BookError WHERE portal = :portal" ,
926- "select count(__) FROM BookError WHERE portal = :portal" );
926+ "select count(__) FROM BookError AS __ WHERE portal = :portal" );
927927
928928 assertCountQuery ("FROM BookError b WHERE portal = :portal" ,
929929 "select count(b) FROM BookError b WHERE portal = :portal" );
You can’t perform that action at this time.
0 commit comments