I have two 3 tables in my database:
group ---------- groupId PK name
user_account ---------- userId PK
user_grouping ---------- groupId PK FK grouping(groupId -> groupId) userId PK FK user_account(userId -> userId)
In my UserAccount Entity, I have the following line:
@JoinTable(name = "user_group", joinColumns = {
@JoinColumn(name = "userId", referencedColumnName = "userId")}, inverseJoinColumns = {
@JoinColumn(name = "groupId", referencedColumnName = "groupId")})
@ManyToMany
private List<Grouping> groupingList;
This is to show the relationship between all the tables. However, when I deploy, I get the following error:
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) ...
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?