1 package org.hibernate.mapping; 3 4 import java.util.Iterator ; 5 6 import org.hibernate.dialect.Dialect; 7 8 12 public class PrimaryKey extends Constraint { 13 14 public String sqlConstraintString(Dialect dialect) { 15 StringBuffer buf = new StringBuffer ("primary key ("); 16 Iterator iter = getColumnIterator(); 17 while ( iter.hasNext() ) { 18 buf.append( ( (Column) iter.next() ).getQuotedName(dialect) ); 19 if ( iter.hasNext() ) buf.append(", "); 20 } 21 return buf.append(')').toString(); 22 } 23 24 public String sqlConstraintString(Dialect dialect, String constraintName, String defaultCatalog, String defaultSchema) { 25 StringBuffer buf = new StringBuffer ( 26 dialect.getAddPrimaryKeyConstraintString(constraintName) 27 ).append('('); 28 Iterator iter = getColumnIterator(); 29 while ( iter.hasNext() ) { 30 buf.append( ( (Column) iter.next() ).getQuotedName(dialect) ); 31 if ( iter.hasNext() ) buf.append(", "); 32 } 33 return buf.append(')').toString(); 34 } 35 } 36 | Popular Tags |