ruthst00 commented on code in PR #16573:
URL: https://github.com/apache/grails-core/pull/16573#discussion_r4357246814
##########
grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/query/ExpressionResolver.java:
##########
@@ -101,25 +104,45 @@ private Expression<?> resolveFromAlias(String alias,
String subPath) {
return aliased; // It's a non-From expression (projection alias)
or subPath is null
}
- // 2. Check if already joined in THIS or PARENT JoinTracker
(correlated joins)
- aliased = joinTracker.getJoin(alias);
- if (aliased != null) {
- aliasRegistry.realize(alias, aliased);
- return subPath != null ? getPath((From<?, ?>) aliased, subPath) :
aliased;
+ HibernateAlias def = aliasRegistry.getDefinition(alias);
+ if (def == null || def.path() == null) {
+ return null;
}
-
- // 3. If defined but not joined, materialize it on the CURRENT root
- if (aliasRegistry.isDefined(alias)) {
- HibernateAlias def = aliasRegistry.getDefinition(alias);
- if (def != null && def.path() != null) {
- aliased = joinTracker.getRoot().join(def.path(),
def.joinType());
- aliasRegistry.realize(alias, aliased);
- joinTracker.addJoin(alias, (From<?, ?>) aliased);
- return subPath != null ? getPath((From<?, ?>) aliased,
subPath) : aliased;
+ if (!def.explicit()) {
+ aliased = resolveAssociation(def.path(), def.joinType());
Review Comment:
Fixed in
https://github.com/apache/grails-core/pull/16573/changes/64ac919cb4d7d2592427323ac2ef066445811a96
--
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]