Skip to content

Commit

Permalink
HHH-8263 secondary table's primary key is not created
Browse files Browse the repository at this point in the history
  • Loading branch information
stliu committed May 23, 2013
1 parent 3e59f96 commit cc5b4b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Expand Up @@ -900,6 +900,8 @@ private void bindSecondaryTables(
entityBinding.getPrimaryTable().getLogicalName().getText()
)
);
joinColumn.setNullable( false );
table.getPrimaryKey().addColumn( joinColumn );
joinRelationalValueBindings.add( new RelationalValueBinding( entityBinding.getPrimaryTable(), joinColumn, true, false ) );
}
}
Expand All @@ -926,6 +928,8 @@ private void bindSecondaryTables(
if ( joinColumnSource.getSqlType() != null ) {
column.setSqlType( joinColumnSource.getSqlType() );
}
column.setNullable( false );
table.getPrimaryKey().addColumn( column );
}
joinRelationalValueBindings.add( new RelationalValueBinding( table, column, true, false ) );
}
Expand Down Expand Up @@ -953,6 +957,9 @@ private void bindSecondaryTables(
secondaryTable.setInverse( secondaryTableSource.isInverse() );
secondaryTable.setOptional( secondaryTableSource.isOptional() );
secondaryTable.setCascadeDeleteEnabled( secondaryTableSource.isCascadeDeleteEnabled() );
if ( secondaryTable.isCascadeDeleteEnabled() ) {
foreignKey.setDeleteRule( ForeignKey.ReferentialAction.CASCADE );
}
entityBinding.addSecondaryTable( secondaryTable );
}
}
Expand Down
Expand Up @@ -92,7 +92,6 @@ public void testHigherLevelIndexDefinition() throws Throwable {
}

@Test
@FailureExpectedWithNewMetamodel
public void testSubclassing() throws Exception {
Session s = openSession();
Transaction t = s.beginTransaction();
Expand Down

0 comments on commit cc5b4b2

Please sign in to comment.