name += "_" + hibernateColumn.getName().toUpperCase();
uniqueConstraint.addColumn(i, new Column(hibernateColumn.getName()).setRelation(table));
i++;
}
Index index = getBackingIndex(uniqueConstraint, hibernateTable, snapshot);
uniqueConstraint.setBackingIndex(index);
LOG.info("Found unique constraint " + uniqueConstraint.toString());
table.getUniqueConstraints().add(uniqueConstraint);
}
Iterator columnIterator = hibernateTable.getColumnIterator();
while (columnIterator.hasNext()) {
org.hibernate.mapping.Column column = (org.hibernate.mapping.Column) columnIterator.next();
if(column.isUnique()) {
UniqueConstraint uniqueConstraint = new UniqueConstraint();
uniqueConstraint.setTable(table);
String name = "UC_" + table.getName().toUpperCase() + column.getName().toUpperCase() + "_COL";
if (name.length() > 64) {
name = name.substring(0, 63);
}
uniqueConstraint.addColumn(0, new Column(column.getName()).setRelation(table));
uniqueConstraint.setName(name);
LOG.info("Found unique constraint " + uniqueConstraint.toString());
table.getUniqueConstraints().add(uniqueConstraint);
Index index = getBackingIndex(uniqueConstraint, hibernateTable, snapshot);
uniqueConstraint.setBackingIndex(index);
}
}
}