• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why join keyword is needed

 
ajse ruku
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
e.id == d.eid.

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

Thanks,
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The join keyword is left off for example when there is no relationship between the entities as described in this post:
http://www.coderanch.com/t/487010/ORM/databases/jpql-join

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
http://java-persistence-performance.blogspot.com/2012/04/objects-vs-data-and-filtering-join.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic