• 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

Hibernate one to many mapping with foreign key association

 
Ranch Hand
Posts: 212
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am following the example given in  the below link

https://howtodoinjava.com/hibernate/hibernate-one-to-many-mapping-using-annotations/

In this there is one to many relation  between Employee and Account. Employee is the one side of the relationship. Account is the many side of the relationship.

Here the extra association column needs to be generated on the Account side but the JoinColumn annotation is used in the Employee entity.

Is the joincolumn annotation not supposed to be used on the owning side(side responsible for association column update) which is the Account entity since it is the many side of the relationship and defaulting to the owning side(since it is the many side of the relationship)?


 
That which doesn't kill us makes us stronger. I think a piece of pie wouldn't kill me. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic