/** * This function saves the relation data in HashSet. * * @param col this is the collection which contains all data * @param rel_type this is Many-To-Many ot Many-To-One * @throws Exception */ private static void saveRelations(Collection col, String rel_type) throws Exception { String className = col.getOwnerClass().getName(); String relatedClassName = col.getElement().getType().getName(); String roleAttribute = col.getRole(); String relationType = rel_type; String relationTable = col.getElement().getTable().getName(); String keyId = getKeyId(roleAttribute); String roleId = getRoleKeyId(roleAttribute); ClassRelationshipData hmc = new ClassRelationshipData( className, relatedClassName, roleAttribute, relationType, relationTable, keyId, roleId); mappings.add(hmc); List list1 = HibernateMetaData.getSubClassList(col.getOwnerClass().getName()); for (int i = 0; i < list1.size(); i++) { hmc = new ClassRelationshipData( list1.get(i).toString(), relatedClassName, roleAttribute, relationType, relationTable, keyId, roleId); mappings.add(hmc); } List list2 = HibernateMetaData.getSubClassList(col.getElement().getType().getName()); for (int i = 0; i < list2.size(); i++) { hmc = new ClassRelationshipData( className, list2.get(i).toString(), roleAttribute, relationType, relationTable, keyId, roleId); mappings.add(hmc); } }