Example usage for org.hibernate.mapping UniqueKey getName

List of usage examples for org.hibernate.mapping UniqueKey getName

Introduction

In this page you can find the example usage for org.hibernate.mapping UniqueKey getName.

Prototype

public String getName() 

Source Link

Usage

From source file:org.teiid.spring.views.ViewBuilder.java

License:Apache License

private void addIndexKeys(org.hibernate.mapping.Table ormTable, Table view, MetadataFactory mf) {
    Iterator<UniqueKey> keys = ormTable.getUniqueKeyIterator();
    while (keys.hasNext()) {
        UniqueKey uk = keys.next();
        List<String> columns = new ArrayList<>();
        for (org.hibernate.mapping.Column c : uk.getColumns()) {
            columns.add(c.getName());//from w w w  .jav  a2 s  .  c  o  m
        }
        mf.addIndex(uk.getName(), false, columns, view);
    }

    Iterator<Index> iit = ormTable.getIndexIterator();
    while (iit.hasNext()) {
        Index idx = iit.next();
        List<String> columns = new ArrayList<>();
        Iterator<org.hibernate.mapping.Column> it = idx.getColumnIterator();
        while (it.hasNext()) {
            org.hibernate.mapping.Column c = it.next();
            columns.add(c.getName());
        }
        mf.addIndex(idx.getName(), true, columns, view);
    }
}