• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

incomplete @JoinColumns

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 553
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 have gone to look for myself. If I should return before I get back, keep me here with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic