Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Criteria for retriving data involving multiple joins

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
roses are red, violets are blue. Some poems rhyme and some are a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic