int columnNumber = 1;
for (int i = 0; i < columnNames.length; i++) {
String columnName = columnNames[i];
if (HBaseDataContext.FIELD_ID.equals(columnName)) {
final ColumnType type = types[i];
final MutableColumn idColumn = new MutableColumn(HBaseDataContext.FIELD_ID, type)
.setPrimaryKey(true).setColumnNumber(columnNumber).setTable(this);
addColumn(idColumn);
columnNumber++;
}
}
if (columnNumber == 1) {
// insert a default definition of the id column
final MutableColumn idColumn = new MutableColumn(HBaseDataContext.FIELD_ID,
defaultRowKeyColumnType).setPrimaryKey(true).setColumnNumber(columnNumber).setTable(this);
addColumn(idColumn);
columnNumber++;
}
for (int i = 0; i < columnNames.length; i++) {
final String columnName = columnNames[i];
if (!HBaseDataContext.FIELD_ID.equals(columnName)) {
final ColumnType type = types[i];
final MutableColumn column = new MutableColumn(columnName, type);
column.setTable(this);
column.setColumnNumber(columnNumber);
columnNumber++;
addColumn(column);