• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

incomplete @JoinColumns

 
eve agostini
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 553
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
eve agostini
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic