HHH-18628 Regression: Unable to determine TableReference
This commit is contained in:
parent
1b9bad4f30
commit
08391eb3ae
|
@ -246,7 +246,7 @@ public class SqmUtil {
|
|||
* or one that has an explicit on clause predicate.
|
||||
*/
|
||||
public static boolean isFkOptimizationAllowed(SqmPath<?> sqmPath, EntityAssociationMapping associationMapping) {
|
||||
if ( sqmPath instanceof SqmJoin<?, ?> sqmJoin ) {
|
||||
if ( associationMapping.isFkOptimizationAllowed() && sqmPath instanceof SqmJoin<?, ?> sqmJoin ) {
|
||||
switch ( sqmJoin.getSqmJoinType() ) {
|
||||
case LEFT:
|
||||
if ( isFiltered( associationMapping ) ) {
|
||||
|
|
|
@ -4138,12 +4138,11 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
|||
if ( inferredEntityMapping == null ) {
|
||||
// When the inferred mapping is null, we try to resolve to the FK by default, which is fine because
|
||||
// expansion to all target columns for select and group by clauses is handled in EntityValuedPathInterpretation
|
||||
if ( entityValuedModelPart instanceof EntityAssociationMapping
|
||||
&& isFkOptimizationAllowed( path, (EntityAssociationMapping) entityValuedModelPart ) ) {
|
||||
if ( entityValuedModelPart instanceof EntityAssociationMapping associationMapping
|
||||
&& isFkOptimizationAllowed( path, associationMapping ) ) {
|
||||
// If the table group uses an association mapping that is not a one-to-many,
|
||||
// we make use of the FK model part - unless the path is a non-optimizable join,
|
||||
// for which we should always use the target's identifier to preserve semantics
|
||||
final EntityAssociationMapping associationMapping = (EntityAssociationMapping) entityValuedModelPart;
|
||||
final ModelPart targetPart = associationMapping.getForeignKeyDescriptor().getPart(
|
||||
associationMapping.getSideNature()
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue