• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Understanding @JoinColumn

 
rouven gorsky
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am new to the ORM Concept. A basic question:

Given the following two a) and b) legal Entity-declarations:

a)


b)

Can anyone explain me, what's the difference in usage between the two? (I don't really understand what @JoinColumn is for.

Thanks for clarifying.

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is unnecessarily difficult to read. You can edit your post by using the button.
 
James Sutherland
Ranch Hand
Posts: 553
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@JoinColumn is to specify the name of the foreign key column. If you do not provide a JoinColumn the name of the column will be defaulted.
You can also specify DDL related information in the JoinColumn.

Giving an empty @JoinColumn is not very useful, as it is still being defaulted, there is not any difference to not providing one at all.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic