/** * This function gets the key Id from hibernate mappings and returns the value * * @param attributeName * @return key Id */ public static String getKeyId(String attributeName) { net.sf.hibernate.mapping.Collection col1 = cfg.getCollectionMapping(attributeName); Iterator keyIt = col1.getKey().getColumnIterator(); while (keyIt.hasNext()) { Column col = (Column) keyIt.next(); return (col.getName()); } return ""; }