Example usage for org.hibernate.mapping Table getOrCreateUniqueKey

List of usage examples for org.hibernate.mapping Table getOrCreateUniqueKey

Introduction

In this page you can find the example usage for org.hibernate.mapping Table getOrCreateUniqueKey.

Prototype

public UniqueKey getOrCreateUniqueKey(String keyName) 

Source Link

Usage

From source file:org.codehaus.groovy.grails.orm.hibernate.cfg.AbstractGrailsDomainBinder.java

License:Apache License

protected void createUniqueKeyForColumns(Table table, String columnName, List<Column> keyList) {
    Collections.reverse(keyList);
    UniqueKey key = table.getOrCreateUniqueKey("unique_" + columnName);
    List<?> columns = key.getColumns();
    if (columns.isEmpty()) {
        LOG.debug("create unique key for " + table.getName() + " columns = " + keyList);
        key.addColumns(keyList.iterator());
    }/*from   w  w  w . j  a v a2s .com*/
}

From source file:org.codehaus.groovy.grails.orm.hibernate.cfg.GrailsDomainBinder.java

License:Apache License

private static void createUniqueKeyForColumns(Table table, String columnName, List<Column> keyList) {
    Collections.reverse(keyList);
    UniqueKey key = table.getOrCreateUniqueKey("unique-" + columnName);
    List<?> columns = key.getColumns();
    if (columns.isEmpty()) {
        LOG.debug("create unique key for " + table.getName() + " columns = " + keyList);
        key.addColumns(keyList.iterator());
    }//  ww w . jav  a2s.co  m
}