@Override
public String getName() {
if (!isManyToMany())
return super.getName();
String table, property;
Type target = getJavaType();
JPAClass targetJPA = klass.getRegistry().getJPAClass(target.qualifiedTypeName());
if (!owning) {
Relation inverseRelation = targetJPA.getRelation(mappedBy);
joinTable = inverseRelation.joinTable;
}
if (joinTable == null) {
table = klass.getName() + "_" + target.typeName();
property = target.typeName();
} else {
table = (String) Utils.getAnnotationValue(joinTable, "name");
AnnotationValue[] joinColumns = (AnnotationValue[]) Utils
.getAnnotationValue(joinTable, owning ? "joinColumns" : "inverseJoinColumns");
AnnotationDesc joinColumn = (AnnotationDesc) joinColumns[0].value();