This week's book giveaway is in the OCAJP forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes why join keyword is needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "why join keyword is needed" Watch "why join keyword is needed" New topic

why join keyword is needed

ajse ruku
Ranch Hand

Joined: May 06, 2005
Posts: 194
Hi all,

Being a entry level programmer, i want to know very basic thing. Why does hibernate queries need "Join" keyword. Is it just syntactical thing ?

In plain SQL, we can write something like Select from Employee e , Department d where == d.eid.

There is no Join keyword used here still its inner join. Is'nt ?

Bill Gorder

Joined: Mar 07, 2010
Posts: 1680

The join keyword is left off for example when there is no relationship between the entities as described in this post:

However implicit join syntax can be used where the associations are de-referenced using dot notations which results in an inner join in the resulting SQL statement.

Have a read of this blog, which I think did a pretty good job explaining things

[How To Ask Questions][Read before you PM me]
Don't get me started about those stupid light bulbs.
subject: why join keyword is needed