File tree Expand file tree Collapse file tree 4 files changed +19
-8
lines changed
hibernate-core/src/main/java/org/hibernate/query/sqm/tree Expand file tree Collapse file tree 4 files changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,6 @@ public Set<ParameterExpression<?>> getParameters() {
97
97
98
98
@ Override
99
99
public String generateAlias () {
100
- return "t_ " + (++aliasCounter );
100
+ return "var_ " + (++aliasCounter );
101
101
}
102
102
}
Original file line number Diff line number Diff line change @@ -93,11 +93,12 @@ public void clearFetched() {
93
93
}
94
94
95
95
private void validateFetchAlias (String alias ) {
96
- // if ( fetchJoin && alias != null && nodeBuilder().isJpaQueryComplianceEnabled() ) {
97
- // throw new IllegalStateException(
98
- // "The JPA specification does not permit specifying an alias for fetch joins."
99
- // );
100
- // }
96
+ if ( fetchJoin && alias != null && !alias .startsWith ( "var_" )
97
+ && nodeBuilder ().isJpaQueryComplianceEnabled () ) {
98
+ throw new IllegalStateException (
99
+ "The JPA specification does not permit specifying an alias for fetch joins."
100
+ );
101
+ }
101
102
}
102
103
103
104
@ Override
Original file line number Diff line number Diff line change @@ -976,6 +976,16 @@ public JpaExpression<?> id() {
976
976
private int aliasCounter = 0 ;
977
977
978
978
private String generateAlias () {
979
- return alias + "_" + (++aliasCounter );
979
+ final String prefix ;
980
+ if ( alias == null ) {
981
+ prefix = "var_" ;
982
+ }
983
+ else if ( alias .startsWith ( "var_" ) ) {
984
+ prefix = alias ;
985
+ }
986
+ else {
987
+ prefix = "var_" + alias ;
988
+ }
989
+ return prefix + "_" + (++aliasCounter );
980
990
}
981
991
}
Original file line number Diff line number Diff line change @@ -612,6 +612,6 @@ else if ( !newSelections.contains( selection ) ) {
612
612
613
613
@ Override
614
614
public String generateAlias () {
615
- return "t_ " + (++aliasCounter );
615
+ return "var_ " + (++aliasCounter );
616
616
}
617
617
}
You can’t perform that action at this time.
0 commit comments