title: Using JPA CompositeKey uses a property from another Entity
body: <p>I tried searching but was having problems finding what I want. I have the following schema( * indicates primary key)</p>
  
  <pre><code>USER
    *UserId
    -Desc
  Registration
    *DeviceId
    *UserId
    -date
  </code></pre>
  
  <p>So I want to create a primary key for Registration like...</p>
  
  <pre><code>@Embeddable
  public class RegPk{
      private String deviceId;
      private User user;
      @Column(name="DEV_ID")
      public String getDevId(){
        return deviceId;
      }
      ...
      @ManyToOne
      @JoinColumn(name="USER_ID", referencedColumnName="USER_ID")
      public User getUser() {
        return user;
      }
      ...
  }
  </code></pre>
  
  <p>Is this right? Will it update the USER_ID field properly update in registration when I persist?</p>
  
  <p>When I try this kind of thing out I get the following....</p>
  
  <blockquote>
    <p>[10/7/13 13:37:07:156 EDT] 000000ae webapp        E com.ibm.ws.webcontainer.webapp.WebApp logServletError SRVE0293E: [Servlet Error]-[Hello]:  org.apache.openjpa.util.MetaDataException: The id class specified by type "class org.me.mfa.jpa.Registration" does not match the primary key fields of the class.  Make sure your identity class has the same primary keys as your persistent type, including pk field types. Mismatched property: "user"</p>
  </blockquote>
  
  <p>So what now?</p>