Example usage for org.hibernate.mapping PrimaryKey isGenerated

List of usage examples for org.hibernate.mapping PrimaryKey isGenerated

Introduction

In this page you can find the example usage for org.hibernate.mapping PrimaryKey isGenerated.

Prototype

public boolean isGenerated(Dialect dialect) 

Source Link

Usage

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

License:Apache License

private void addPrimaryKey(org.hibernate.mapping.Table ormTable, Table view, MetadataFactory mf) {
    PrimaryKey pk = ormTable.getPrimaryKey();
    List<String> pkColumns = new ArrayList<>();
    if (pk != null) {
        Iterator<org.hibernate.mapping.Column> it = pk.getColumnIterator();
        while (it.hasNext()) {
            org.hibernate.mapping.Column c = it.next();
            Column col = view.getColumnByName(c.getName());
            if (pk.isGenerated(dialect)) {
                col.setAutoIncremented(true);
            }/* w  w w . j a  v a 2s.com*/
            pkColumns.add(c.getName());
        }
        mf.addPrimaryKey("PK", pkColumns, view);
    }

}