• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

@primarykeyjoincolumn for OnetoMany and ManytoOne?

 
Ranch Hand
Posts: 270
Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I just want to know if we can implement OnetoMany and ManytoMany relation ships using @primarykeyJoinColumn.
In EJB in Action OnetoMany and ManytoMany are implemented using @JoinColumn annotation where as OnetoOne is implemented by using both @JoinColumn and @primarykeyJoinColumn annotations.

It would be great if anybody can post the implementation part.

Regards
Sudhakar
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as relationships are concerned, @PrimaryKeyJoinColumn can only be applied to @OneToOne relationship, as it "joins" two entities by their primary keys. That's why it wouldn't make sence for ManyToXXX relationships (because primary keys are "unique").
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic