HHH-15260 Criteria query is unable to determine TableReference when combining subquery with join
This commit is contained in:
parent
f0cb0e8f78
commit
e29884b764
|
@ -1637,7 +1637,7 @@ public class ToOneAttributeMapping
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( navigablePath.equals( np.getParent() ) ) {
|
||||
if ( navigablePath.pathsMatch( np.getParent() ) ) {
|
||||
return targetKeyPropertyNames.contains( np.getLocalName() );
|
||||
}
|
||||
|
||||
|
|
|
@ -3108,6 +3108,9 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
|||
}
|
||||
else {
|
||||
tableGroup = compatibleTableGroup;
|
||||
// Also register the table group under its original navigable path, which possibly contains an alias
|
||||
// This is important, as otherwise we might create new joins in subqueries which are unnecessary
|
||||
fromClauseIndex.registerTableGroup( tableGroup.getNavigablePath(), tableGroup );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -191,6 +191,11 @@ public class NavigablePath implements DotIdentifierSequence, Serializable {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean pathsMatch(NavigablePath p) {
|
||||
return this == p || p != null && localName.equals( p.localName )
|
||||
&& ( parent == null ? p.parent == null && Objects.equals( alias, p.alias ) : parent.pathsMatch( p.parent ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ignores aliases in the resulting String
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue