File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Data fetch from multiple SQL tables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Data fetch from multiple SQL tables" Watch "Data fetch from multiple SQL tables" New topic

Data fetch from multiple SQL tables

mallika arora

Joined: Aug 02, 2007
Posts: 5
I am in the process of writing my first hibernate application. I have a sql query that fetches data from multiple tables using left and right outer joins. I need to convert this JDBC data access code into Hibernate code. The tables in SQL are not related using foreign keys.

I have created hibernate mapping for each table, datasource configuration xml and POJO for each table. I am unable to follow how to use HQL createQuery that would use table classes to retrieve data from 8 or 9 tables.

Any example of HQL fetching data from multiple tables would be a help.

Please advice.

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

From the Hibernate documentation pages


Describing implicit versus explicit joins

Where clauses



Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Aniket S. Kulkarni
Ranch Hand

Joined: Jun 15, 2011
Posts: 87

@Mark Spritzler: Sir, These are not valid links. Please provide new valid links. Thanks!

Aniket Kulkarni
Oracle Certified Professional, Java SE 6 Programmer.
I agree. Here's the link:
subject: Data fetch from multiple SQL tables
jQuery in Action, 3rd edition