FileDocCategorySizeDatePackage
Constraint.javaAPI DocHibernate 3.2.52670Mon Oct 30 19:18:40 GMT 2006org.hibernate.mapping

Constraint

public abstract class Constraint extends Object implements Serializable, RelationalModel
A relational constraint.
author
Gavin King

Fields Summary
private String
name
private final List
columns
private Table
table
Constructors Summary
Methods Summary
public voidaddColumn(Column column)

		if ( !columns.contains( column ) ) columns.add( column );
	
public voidaddColumns(java.util.Iterator columnIterator)

		while ( columnIterator.hasNext() ) {
			Selectable col = (Selectable) columnIterator.next();
			if ( !col.isFormula() ) addColumn( (Column) col );
		}
	
public java.util.IteratorcolumnIterator()

		return columns.iterator();
	
public booleancontainsColumn(Column column)

param
column
return
true if this constraint already contains a column with same name.

		return columns.contains( column );
	
public ColumngetColumn(int i)

		return (Column) columns.get( i );
	
public java.util.IteratorgetColumnIterator()

		return columns.iterator();
	
public intgetColumnSpan()

		return columns.size();
	
public java.util.ListgetColumns()

		return columns;
	
public java.lang.StringgetName()


	   
		return name;
	
public TablegetTable()

		return table;
	
public booleanisGenerated(org.hibernate.dialect.Dialect dialect)

		return true;
	
public voidsetName(java.lang.String name)

		this.name = name;
	
public voidsetTable(Table table)

		this.table = table;
	
public abstract java.lang.StringsqlConstraintString(org.hibernate.dialect.Dialect d, java.lang.String constraintName, java.lang.String defaultCatalog, java.lang.String defaultSchema)

public java.lang.StringsqlCreateString(org.hibernate.dialect.Dialect dialect, org.hibernate.engine.Mapping p, java.lang.String defaultCatalog, java.lang.String defaultSchema)

		if ( isGenerated( dialect ) ) {
			String constraintString = sqlConstraintString( dialect, getName(), defaultCatalog, defaultSchema );
			StringBuffer buf = new StringBuffer( "alter table " )
					.append( getTable().getQualifiedName( dialect, defaultCatalog, defaultSchema ) )
					.append( constraintString );
			return buf.toString();
		}
		else {
			return null;
		}
	
public java.lang.StringsqlDropString(org.hibernate.dialect.Dialect dialect, java.lang.String defaultCatalog, java.lang.String defaultSchema)

		if ( isGenerated( dialect ) ) {
			return "alter table " + getTable()
					.getQualifiedName( dialect, defaultCatalog, defaultSchema ) + " drop constraint " + getName();
		}
		else {
			return null;
		}
	
public java.lang.StringtoString()

		return getClass().getName() + '(" + getTable().getName() + getColumns() + ") as " + name;