/** * This function checks weather relation is Many-Many * * @param classObj1 * @param classObj2 * @return true is relation is Many-Many otherwise false */ public static boolean isRelationManyToMany( Class classObj1, Class classObj2, String roleAttributeName) { ClassRelationshipData crd = new ClassRelationshipData(classObj1.getName(), classObj2.getName(), roleAttributeName); Iterator itr = mappings.iterator(); while (itr.hasNext()) { ClassRelationshipData crd1 = (ClassRelationshipData) itr.next(); if (crd1.equals(crd) && crd1.getRelationType().equals("ManyToMany")) { return true; } } return false; }
public static ClassRelationshipData getClassRelationshipData( Class classObj1, Class classObj2, String roleAttributeName) { ClassRelationshipData crd = new ClassRelationshipData(classObj1.getName(), classObj2.getName(), roleAttributeName); Iterator itr = mappings.iterator(); while (itr.hasNext()) { ClassRelationshipData crd1 = (ClassRelationshipData) itr.next(); if (crd1.equals(crd)) { return crd1; } } return null; }