*
The moose likes Object Relational Mapping and the fly likes incomplete @JoinColumns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "incomplete @JoinColumns " Watch "incomplete @JoinColumns " New topic
Author

incomplete @JoinColumns

eve agostini
Ranch Hand

Joined: Nov 01, 2005
Posts: 43
Hi all,
I'm trying to set up a ManyToMany relationship but I'm getting the following error:


Exception Description: The @JoinColumns on the annotated element [field gruppi] from the entity class [class users.model.entities.Utente] 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.


I'm a little confused because I don't think I'm using a composite key....

Here is the code for the class Utente (owner of the relationship):



And here is the code for the class Gruppo:




It must be something very stupid but I'm just not seeing it!

Thanks for any help

Eve
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
Your code looks correct, assuming there is no @Id in the ... code your not showing.
Are you sure the error occurs on the same code, (did you change the code and not rebuild properly?).

Can you include the full exception stack and what JPA provider/version you are using.


TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
eve agostini
Ranch Hand

Joined: Nov 01, 2005
Posts: 43
It turned out the error was caused by another field, placed just above the "gruppi" one in the class, which I omitted in the code above...not sure why in the exception that field was mentioned...anyway there was actually something wrong in the other field...I solved the problem :P

Thanks for your help!

Eve
 
 
subject: incomplete @JoinColumns
 
Similar Threads
Mysql auto generated PK used for another table and JPA
Can a class be mapped to a table and be Embeddable at the same time?
Apache Derby Sql Statement's
JPA: Problem with InheritanceType.SINGLE_TABLE
OneToOne Relation Exception