aspose file tools*
The moose likes Object Relational Mapping and the fly likes Criteria for retriving data involving multiple joins Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Criteria for retriving data involving multiple joins" Watch "Criteria for retriving data involving multiple joins" New topic
Author

Criteria for retriving data involving multiple joins

Harish Harry
Greenhorn

Joined: Jun 19, 2012
Posts: 1
I have four tables with sample data related with eachother as below


**Employee**

EMP_ID|EMP_NAME
---------------
101 |John

**EmployeeDtl**

EMP_DTL_ID |EMP_SKILLS |EMP_ID
-----------------------------------
1001 |Java |101
1002 |SQL |101


**EmpDeptDtl**

EMP_DTL_ID |DEPT_ID
--------------------
1001 |22
1002 |33

**Dept**

DEPT_ID |DEPT_NAME
----------------------
22 |XYZ
33 |PQR


Below are my corresponding pojos






Now, Can anyone suggest me on how to retrieve the list of Dept records for the given EMP_ID using CRITERIA. In the above sample data given, for the EMP_ID=101, the dept records with dept_ids 22 and 33 should be returned.

I got the solution using Named query and native SQl query. But I couln't get it through the hibernate CRITERIA. Can anyone please help me in this?

Thanks
Harish
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Criteria for retriving data involving multiple joins