Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using @JoinColumn VS not using @JoinColumn  RSS feed

Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I would just like to clarify the difference between the following 2 code samples from EJB3 in Action:
First code sample:

2nd Code Sample:

The 2nd code sample is missing the @JoinColumn.

So in the 1st case it would be possible to use the foreign key in the User table to locate the relevant Bid/s using SQL.

Whereas the 2nd case wouldn't have a foreign key BUT it would still be possible to access the relevant Bid/s through the User object's reference to a collection of Bids albeit only via JPQL this time?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!