ruthst00 commented on code in PR #16573:
URL: https://github.com/apache/grails-core/pull/16573#discussion_r4340126539
##########
grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/query/ExpressionResolver.java:
##########
@@ -112,7 +112,13 @@ private Expression<?> resolveFromAlias(String alias,
String subPath) {
if (aliasRegistry.isDefined(alias)) {
HibernateAlias def = aliasRegistry.getDefinition(alias);
if (def != null && def.path() != null) {
- aliased = joinTracker.getRoot().join(def.path(),
def.joinType());
+ // The association criteria and its alias must refer to the
same physical join,
+ // regardless of whether a predicate, projection or order
resolves it first.
+ aliased = joinTracker.getJoin(def.path());
Review Comment:
Fixed in
https://github.com/apache/grails-core/pull/16573/changes/69b2726dae41b3d6f514c9c59f4ad349d8532907
##########
grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/query/ExpressionResolver.java:
##########
@@ -112,7 +112,13 @@ private Expression<?> resolveFromAlias(String alias,
String subPath) {
if (aliasRegistry.isDefined(alias)) {
HibernateAlias def = aliasRegistry.getDefinition(alias);
if (def != null && def.path() != null) {
- aliased = joinTracker.getRoot().join(def.path(),
def.joinType());
+ // The association criteria and its alias must refer to the
same physical join,
+ // regardless of whether a predicate, projection or order
resolves it first.
+ aliased = joinTracker.getJoin(def.path());
+ if (aliased == null) {
+ aliased = joinTracker.getRoot().join(def.path(),
def.joinType());
+ joinTracker.addJoin(def.path(), (From<?, ?>) aliased);
Review Comment:
Fixed in
https://github.com/apache/grails-core/pull/16573/changes/69b2726dae41b3d6f514c9c59f4ad349d8532907
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]