title: Modeling Table Relationships using JPA in Java EE
body: <p>I have two 3 tables in my database:</p>
  
  <pre>
  group
  ----------
  groupId    PK
  name
  </pre>
  
  <pre>
  user_account
  ----------
  userId        PK
  </pre>
  
  <pre>
  user_grouping
  ----------
  groupId     PK    FK grouping(groupId -> groupId)
  userId      PK    FK user_account(userId -> userId)
  </pre>
  
  <p>In my UserAccount Entity, I have the following line:</p>
  
  <pre><code>@JoinTable(name = "user_group", joinColumns = {
      @JoinColumn(name = "userId", referencedColumnName = "userId")}, inverseJoinColumns = {
      @JoinColumn(name = "groupId", referencedColumnName = "groupId")})
  @ManyToMany
  private List&lt;Grouping&gt; groupingList;
  </code></pre>
  
  <p>This is to show the relationship between all the tables. However, when I deploy, I get the following error:</p>
  
  <pre>
  SEVERE: Exception while preparing the app : Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.EntityManagerSetupException
  Exception Description: Predeployment of PersistenceUnit [com.dv_model_ejb_1.0-SNAPSHOTPU] failed.
  Internal Exception: Exception [EclipseLink-7220] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ValidationException
  Exception Description: The @JoinColumns on the annotated element [field groupingList] from the entity class [class com.dv.model.entity.UserAccount] is incomplete. When the source entity class uses a composite primary key, a @JoinColumn must be specified for each join column using the @JoinColumns. Both the name and the referencedColumnName elements must be specified in each such @JoinColumn.
  Local Exception Stack: 
  Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.EntityManagerSetupException
  Exception Description: Predeployment of PersistenceUnit [com.dv_model_ejb_1.0-SNAPSHOTPU] failed.
  Internal Exception: Exception [EclipseLink-7220] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ValidationException
  Exception Description: The @JoinColumns on the annotated element [field groupingList] from the entity class [class com.dv.model.entity.UserAccount] is incomplete. When the source entity class uses a composite primary key, a @JoinColumn must be specified for each join column using the @JoinColumns. Both the name and the referencedColumnName elements must be specified in each such @JoinColumn.
      at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:221)
      at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1402)
  ...
  </pre>
  
  <p>I am not sure exactly how to interpret this error message. I am assuming I do not have the table relationship correctly modeled in my entity. But I am not sure why. Before today, this was compiling fine. Can anyone provide assistance?</p>