title: JPA - EmbeddedId with @ManytoOne
body: <p>I have a problem with my code (obviously) and after many searches on Internet, I don't find an answer to my problem, so I ask my question here.
  I have this : </p>
  
  <pre><code>@Entity
  public class Resident
  {
      /** Attributes */
      @EmbeddedId
      private IdResident idResident;
       ...
  
  @Embeddable
  public class IdResident {
      @Column(name="NOM")
      private String nom;
      @ManyToOne
      @JoinColumn(name="CODE")
      private Port port;
    ...
  
  @Entity
  public class Port
  {
      /** Attributes */
      @Id
      @Column(name="CODE")
      private String code;
      @Column(name="NOM")
      private String nom;
      ...
  </code></pre>
  
  <p>And I'm using Maven, I've write this in my persistence.xml :</p>
  
  <pre><code>&lt;class&gt;beans.Port&lt;/class&gt;
  &lt;class&gt;beans.Resident&lt;/class&gt;   
  </code></pre>
  
  <p>But when i run the program, no matter what i've write, I have this :</p>
  
  <pre><code>Exception Description: The mapping [port] from the embedded ID class 
  [class beans.IdResident] is an invalid mapping for this class. An embeddable class that
   is used with an embedded ID specification (attribute [idResident] from the source 
  [class beans.Resident]) can only contain basic mappings. Either remove the non
   basic mapping or change the embedded ID specification on the source to be embedded.
  </code></pre>
  
  <p>I don't see where is my mistake, I think it's because of the IdResident class wich has an Entity object in it, but I don't know how to fiw it</p>