Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Left join 2 unrelated tables

 
Arun G Nair
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i am new to hibernate
I am having two tables SeatAlloted and SeatPrivilage table,both having a many to one relation with Seat table .now I want to left join SeatAlloted and SeatPrivilage table.
Anybody please tell me how to do that

thanks in regards
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do it with either HQL. Have a read of these useful docs.

Of course, joining unrelated tables is an invalid thing to do. But databases (and Hibernate) won't stop you doing it.
[ November 25, 2008: Message edited by: Paul Sturrock ]
 
Arun G Nair
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reference can You give me a specific answer to my question,is it posible to write a hql query by joining SeatAlloted and left joining SeatPrivilage to Seat table if possible can you give me the syntax
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it is possible. The syntax is very like SQL (since that is what HQL is based on). The linked documentation will tell you how - I don't want to seem unhelpful, but JavaRanch is not intended to be a code mill. But the docs do contain the syntax, so you should get your example in there.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic