This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Using @JoinColumn VS not using @JoinColumn Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Using @JoinColumn VS not using @JoinColumn" Watch "Using @JoinColumn VS not using @JoinColumn" New topic

Using @JoinColumn VS not using @JoinColumn

Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 606

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?

===>SCJP 1.5(72%)<===
wood burning stoves
subject: Using @JoinColumn VS not using @JoinColumn
It's not a secret anymore!