public void refreshPrimaryKeys(DatabaseMetaData metaData) throws SQLException { primaryKeys.clear(); ResultSet rs = null; try { rs = metaData.getPrimaryKeys(catalog, schema, name); while (rs.next()) { PrimaryKey pk = new PrimaryKey(); primaryKeys.add(pk); pk.setOwner(this); pk.setColumnName(rs.getString("COLUMN_NAME")); pk.setKeySequence(rs.getShort("KEY_SEQ")); pk.setName(rs.getString("PK_NAME")); } } catch (SQLException sqle) { throw sqle; } finally { try { rs.close(); } catch (Exception ex) { } } }
public boolean removePrimaryKey(PrimaryKey primaryKey) { primaryKey.setOwner(null); return primaryKeys.remove(primaryKey); }
public void addPrimaryKey(PrimaryKey primaryKey) { primaryKeys.add(primaryKey); primaryKey.setOwner(this); }