title: How to fix ambiguous mapping methods
body: <p>I'm doing an experiment with jHipster.</p>
  
  <p>I have created two entities A and B backed by DTO (mapstruct).
  There is a many-to-many relationship between them.
  They both also have a many-to-one relationship with the user.</p>
  
  <p>Up until creating the last relationship, everything works fine.
  After creating the last many-to-one relationship, I get the following error:</p>
  
  <pre><code>[INFO] --- maven-processor-plugin:2.2.4:process (process) @ m2m ---
  [ERROR] diagnostic: /Users/andy/jhipster-m2m/src/main/java/com/m2m/web/rest/mapper/AMapper.java:18: error: Ambiguous mapping methods found for mapping property "java.lang.Long userId" to com.m2m.domain.User: com.m2m.domain.User userFromId(java.lang.Long id), com.m2m.domain.User com.m2m.web.rest.mapper.BMapper.userFromId(java.lang.Long id).
  A aDTOToA(ADTO aDTO);
    ^
  [ERROR] error on execute: error during compilation
  </code></pre>
  
  <p>The definitions are very straightforward:
  For A:</p>
  
  <pre><code>{
    "relationships": [
      {
          "relationshipId": 1,
          "relationshipName": "b",
          "otherEntityName": "b",
          "relationshipType": "many-to-many",
          "otherEntityField": "id",
          "ownerSide": true
      },
      {
          "relationshipId": 2,
          "relationshipName": "user",
          "otherEntityName": "user",
          "relationshipType": "many-to-one",
          "otherEntityField": "id"
      }
  ],
  "fields": [
      {
          "fieldId": 1,
          "fieldName": "nameA",
          "fieldType": "String"
      }
  ],
  "changelogDate": "20150909165353",
  "dto": "mapstruct",
  "pagination": "no"
  </code></pre>
  
  <p>}</p>
  
  <p>For B:</p>
  
  <pre><code>{
  "relationships": [
      {
          "relationshipId": 1,
          "relationshipName": "a",
          "otherEntityName": "a",
          "relationshipType": "many-to-many",
          "ownerSide": false,
          "otherEntityRelationshipName": "b"
      },
      {
          "relationshipId": 2,
          "relationshipName": "user",
          "otherEntityName": "user",
          "relationshipType": "many-to-one",
          "otherEntityField": "id"
      }
  ],
  "fields": [
      {
          "fieldId": 1,
          "fieldName": "nameB",
          "fieldType": "String"
      }
  ],
  "changelogDate": "20150909165433",
  "dto": "mapstruct",
  "pagination": "no"
  </code></pre>
  
  <p>}</p>
  
  <p>I'm really stuck on this.
  Any help is very much appreciated!!</p>
  
  <p>EDIT: Providing github repo that demonstrates the problem <a href="https://github.com/andyverbunt/jhipster-m2m.git" rel="nofollow">https://github.com/andyverbunt/jhipster-m2m.git</a></p>