Java Code Examples for org.hibernate.mapping.Column#isUnique()
The following examples show how to use
org.hibernate.mapping.Column#isUnique() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpannerTableExporter.java From google-cloud-spanner-hibernate with GNU Lesser General Public License v2.1 | 5 votes |
/** * Processes the columns of the table and creates Unique Constraints for columns * annotated with @Column(unique = true). */ private static void initializeUniqueConstraints(Table table) { Iterator<Column> colIterator = table.getColumnIterator(); while (colIterator.hasNext()) { Column col = colIterator.next(); if (col.isUnique()) { String name = Constraint.generateName("UK_", table, col); UniqueKey uk = table.getOrCreateUniqueKey(name); uk.addColumn(col); } } }