|
The method
org.hibernate.mapping.Table.sqlCreateString(Dialect, Mapping, String, String)
has such lines of code (the most important is bolded):
{{String pkname = null; if ( hasPrimaryKey() && identityColumn ) { *pkname = ( (Column) getPrimaryKey().getColumnIterator().next() ).getQuotedName( dialect );* }
Iterator iter = getColumnIterator(); while ( iter.hasNext() ) { Column col = (Column) iter.next();
buf.append( col.getQuotedName( dialect ) ) .append( ' ' );
if ( identityColumn && col.getQuotedName( dialect ).equals( pkname ) ) { // to support dialects that have their own identity data type if ( dialect.hasDataTypeInIdentityColumn() ) { buf.append( col.getSqlType( dialect, p ) ); }
buf.append( ' ' ) .append( dialect.getIdentityColumnString( col.getSqlTypeCode( p ) ) ); }}} pkname is assigned once as first IDENTITY column and then checked inside the loop. So getIdentityColumnString(...) is called only for one id column, while multiple columns can be IDENTITY-generated in composite ids.
|