HHH-15933 fix FK generated for ref to secondary table

This commit is contained in:
Gavin 2022-12-25 13:02:11 +01:00 committed by Gavin King
parent 1e57f88674
commit 9e9a363154
2 changed files with 3 additions and 4 deletions

View File

@ -107,8 +107,7 @@ public class ManyToOne extends ToOne {
getForeignKeyDefinition(), getForeignKeyDefinition(),
new ArrayList<>( property.getColumns() ) new ArrayList<>( property.getColumns() )
); );
//TODO: if the property belongs to a secondary table, foreignKey.setReferencedTable( property.getValue().getTable() );
// need to call foreignKey.setReferencedTable(table)
foreignKey.setOnDeleteAction( getOnDeleteAction() ); foreignKey.setOnDeleteAction( getOnDeleteAction() );
} }
} }

View File

@ -4,11 +4,11 @@ import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.Ignore;
import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@Ignore @Disabled("test produces broken SQL and issue needs to be fixed")
@TestForIssue(jiraKey = "HHH-15933") @TestForIssue(jiraKey = "HHH-15933")
@SessionFactory @SessionFactory
@DomainModel(annotatedClasses = {Split.class, Reference.class}) @DomainModel(annotatedClasses = {Split.class, Reference.class})