if (failOnError && (tableColumn == null)) {
throw new DatabaseMetaDataMethodException(errMessage, "populatePrimaryKey");
}
// create PK column
PrimaryKeyColumn pkColumn = factory.createPrimaryKeyColumn();
// check if we found the original table column
if (tableColumn != null) {
// mark original table column as part of PK
tableColumn.setPrimaryKeyColumn(Boolean.TRUE);
// clone properties from original table column to the pkcolumn
PropertyUtils.copyProperties(pkColumn, tableColumn);
} else { // recovery if table column is not found but we still want to create pk column
// set name at least
pkColumn.setName(columnName);
}
// modify ordinal position that correspond to the position in PK
pkColumn.setOrdinalPosition(ordinalPosition);
// add PK column to the primary key
pk.addColumn(pkColumn);
}