private static void createXMLMappingManyToMany(Component cfc,PropertyCollection propColl,Element clazz, PageContext pc,Property prop,DatasourceConnection dc, SessionFactoryData data) throws PageException {
Element el = createXMLMappingXToMany(propColl,clazz, pc, cfc,prop,data);
Struct meta = prop.getDynamicAttributes();
Document doc = CommonUtil.getDocument(clazz);
Element m2m = doc.createElement("many-to-many");
el.appendChild(m2m);
// link
setLink(cfc,prop,el,meta,true,data);
setForeignEntityName(cfc,prop, meta, m2m,true,data);
// order-by
String str = toString(cfc,prop,meta,"orderby",data);
if(!Util.isEmpty(str,true))m2m.setAttribute("order-by", str);
// column
str=toString(cfc,prop,meta,"inversejoincolumn",data);
// build fkcolumn name
if(Util.isEmpty(str,true)) {
Component other = loadForeignCFC(pc, cfc, prop, meta,data);
if(other!=null){
boolean isClass=Util.isEmpty(other.getExtends());
// MZ: Recursive search for persistent mappedSuperclass properties
Property[] _props=getProperties(pc,other,dc,meta,isClass, true,data);
PropertyCollection _propColl = splitJoins(cfc,new HashMap<String, PropertyCollection>(), _props,data);
_props=_propColl.getProperties();
Struct m;
Property _prop=null;
for(int i=0;i<_props.length;i++){
m = _props[i].getDynamicAttributes();
// fieldtype
String fieldtype = CommonUtil.toString(m.get(FIELDTYPE,null),null);
if("many-to-many".equalsIgnoreCase(fieldtype)) {
// linktable
String currLinkTable=CommonUtil.toString(meta.get(LINK_TABLE,null),null);
String othLinkTable=CommonUtil.toString(m.get(LINK_TABLE,null),null);
if(currLinkTable.equals(othLinkTable)) {
// cfc name
String cfcName=CommonUtil.toString(m.get(CFC,null),null);
if(cfc.equalTo(cfcName)){
_prop=_props[i];
}
}
}