1 package org.hibernate.mapping; 3 4 import java.util.Iterator ; 5 6 import org.hibernate.util.JoinedIterator; 7 8 11 public class DenormalizedTable extends Table { 12 13 private final Table includedTable; 14 15 public DenormalizedTable(Table includedTable) { 16 this.includedTable = includedTable; 17 includedTable.setHasDenormalizedTables(); 18 } 19 20 public void createForeignKeys() { 21 includedTable.createForeignKeys(); 22 Iterator iter = includedTable.getForeignKeyIterator(); 23 while ( iter.hasNext() ) { 24 ForeignKey fk = (ForeignKey) iter.next(); 25 this.createForeignKey( 26 fk.getName() + Integer.toHexString( getName().hashCode() ), 27 fk.getColumns(), 28 fk.getReferencedEntityName() 29 ); 30 } 31 } 32 33 34 public Iterator getColumnIterator() { 35 return new JoinedIterator( 36 includedTable.getColumnIterator(), 37 super.getColumnIterator() 38 ); 39 } 40 41 42 public boolean containsColumn(Column column) { 43 return super.containsColumn(column) || includedTable.containsColumn(column); 44 } 45 46 public PrimaryKey getPrimaryKey() { 47 return includedTable.getPrimaryKey(); 48 } 49 } 50 | Popular Tags |