List of usage examples for org.hibernate.mapping PrimaryKey isGenerated
public boolean isGenerated(Dialect dialect)
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); } }