Skip to content

Commit

Permalink
HBX-2823: Fix foreign key generation
Browse files Browse the repository at this point in the history
Virtual foreign keys defined in the reveng XML are not correctly created
in the generated model.
  • Loading branch information
fanste authored and koentsje committed Sep 20, 2024
1 parent a05882b commit d23701b
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,9 @@ private void processUserForeignKey(
" references unknown or filtered table " +
TableIdentifier.create(element.getTable()) );
} else {
dependentTables.put(element.getName(), deptable);
List<Column> refColumns = getReferencedColums(referencedTable, element);
referencedColumns.put(element.getName(), refColumns );
dependentColumns.put(element.getName(), getDependendColumns(refColumns, deptable) );
dependentTables.put(element.getName(), deptable);
referencedColumns.put(element.getName(), getReferencedColums(referencedTable, element) );
dependentColumns.put(element.getName(), getDependendColumns(deptable, element) );
}
}

Expand All @@ -264,7 +263,8 @@ private Table determineDependentTable(Map<String, Table> dependentTables, Foreig
userfkTable.getName());
}

private List<Column> getDependendColumns(List<Column> userColumns, Table deptable) {
private List<Column> getDependendColumns(Table deptable, ForeignKey element) {
List<?> userColumns = element.getColumns();
List<Column> depColumns = new ArrayList<Column>(userColumns.size() );
Iterator<?> colIterator = userColumns.iterator();
while(colIterator.hasNext() ) {
Expand Down

0 comments on commit d23701b

Please sign in to comment.