Skip to content

Commit

Permalink
HHH-18399 Avoid collecting duplicate attribute for to-one inverse table
Browse files Browse the repository at this point in the history
  • Loading branch information
mbladel committed Aug 7, 2024
1 parent 1ab7493 commit 5550c20
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3584,6 +3584,8 @@ protected EntityTableMapping[] buildTableMappings() {
final TableMappingBuilder tableMappingBuilder;

final TableMappingBuilder existing = tableBuilderMap.get( tableExpression );

final boolean inverseTable = isInverseTable( relativePosition );
if ( existing == null ) {
final Consumer<SelectableConsumer> selectableConsumerConsumer = tableKeyColumnVisitationSupplier.get();
final List<EntityTableMapping.KeyColumn> keyColumns = new ArrayList<>();
Expand Down Expand Up @@ -3614,7 +3616,7 @@ protected EntityTableMapping[] buildTableMappings() {
relativePosition,
new EntityTableMapping.KeyMapping( keyColumns, identifierMapping ),
!isIdentifierTable && isNullableTable( relativePosition ),
isInverseTable( relativePosition ),
inverseTable,
isIdentifierTable,
insertExpectations[ relativePosition ],
customInsertSql,
Expand All @@ -3636,7 +3638,9 @@ protected EntityTableMapping[] buildTableMappings() {
tableMappingBuilder = existing;
}

collectAttributesIndexesForTable( relativePosition, tableMappingBuilder.attributeIndexes::add );
if ( !inverseTable ) {
collectAttributesIndexesForTable( relativePosition, tableMappingBuilder.attributeIndexes::add );
}
} );

final EntityTableMapping[] list = new EntityTableMapping[tableBuilderMap.size()];
Expand Down

0 comments on commit 5550c20

Please sign in to comment.