Fix ToOneAttributeMapping tableGroup creation

This commit is contained in:
Andrea Boriero 2021-10-13 11:53:16 +02:00
parent fa694c5d41
commit d616f2aa55
1 changed files with 10 additions and 15 deletions

View File

@ -415,21 +415,16 @@ public class LoaderSelectBuilder {
}
else if ( part instanceof ToOneAttributeMapping ) {
final ToOneAttributeMapping toOneAttributeMapping = (ToOneAttributeMapping) part;
if ( toOneAttributeMapping.getSideNature() == ForeignKeyDescriptor.Nature.TARGET ) {
final TableGroupJoin tableGroupJoin = toOneAttributeMapping.createTableGroupJoin(
navigablePath,
rootTableGroup,
null,
SqlAstJoinType.LEFT,
true,
sqlAstCreationState
);
tableGroup = tableGroupJoin.getJoinedGroup();
sqlAstCreationState.getFromClauseAccess().registerTableGroup( navigablePath, tableGroup );
}
else {
tableGroup = rootTableGroup;
}
final TableGroupJoin tableGroupJoin = toOneAttributeMapping.createTableGroupJoin(
navigablePath,
rootTableGroup,
null,
SqlAstJoinType.LEFT,
true,
sqlAstCreationState
);
tableGroup = tableGroupJoin.getJoinedGroup();
sqlAstCreationState.getFromClauseAccess().registerTableGroup( navigablePath, tableGroup );
}
else {
tableGroup = rootTableGroup;