FileDocCategorySizeDatePackage
DenormalizedTable.javaAPI DocHibernate 3.2.52291Wed Nov 29 08:17:28 GMT 2006org.hibernate.mapping

DenormalizedTable

public class DenormalizedTable extends Table
author
Gavin King

Fields Summary
private final Table
includedTable
Constructors Summary
public DenormalizedTable(Table includedTable)

		this.includedTable = includedTable;
		includedTable.setHasDenormalizedTables();
	
Methods Summary
public booleancontainsColumn(Column column)

		return super.containsColumn(column) || includedTable.containsColumn(column);
	
public voidcreateForeignKeys()

		includedTable.createForeignKeys();
		Iterator iter = includedTable.getForeignKeyIterator();
		while ( iter.hasNext() ) {
			ForeignKey fk = (ForeignKey) iter.next();
			createForeignKey( 
					fk.getName() + Integer.toHexString( getName().hashCode() ), 
					fk.getColumns(), 
					fk.getReferencedEntityName() 
				);
		}
	
public ColumngetColumn(Column column)

		Column superColumn = super.getColumn( column );
		if (superColumn != null) {
			return superColumn;
		}
		else {
			return includedTable.getColumn( column );
		}
	
public java.util.IteratorgetColumnIterator()

		return new JoinedIterator(
				includedTable.getColumnIterator(),
				super.getColumnIterator()
			);
	
public java.util.IteratorgetIndexIterator()

		List indexes = new ArrayList();
		Iterator iter = includedTable.getIndexIterator();
		while ( iter.hasNext() ) {
			Index parentIndex = (Index) iter.next();
			Index index = new Index();
			index.setName( getName() + parentIndex.getName() );
			index.setTable(this);
			index.addColumns( parentIndex.getColumnIterator() );
			indexes.add( index );
		}
		return new JoinedIterator(
				indexes.iterator(),
				super.getIndexIterator()
			);
	
public PrimaryKeygetPrimaryKey()

		return includedTable.getPrimaryKey();
	
public java.util.IteratorgetUniqueKeyIterator()

		//wierd implementation because of hacky behavior
		//of Table.sqlCreateString() which modifies the
		//list of unique keys by side-effect on some
		//dialects
		Map uks = new HashMap();
		uks.putAll( getUniqueKeys() );
		uks.putAll( includedTable.getUniqueKeys() );
		return uks.values().iterator();