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 Hibernate Criteria Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate Criteria" Watch "Hibernate Criteria" New topic

Hibernate Criteria

Pradeep Chandrasekharan Nair
Ranch Hand

Joined: Apr 01, 2004
Posts: 48
I have a Candidate bean and inside that I have Job object. If I criteria on Candidate it will give a list of candidates. Is there any way to get a list of jobs instead of candidates if I create criteria on Candidate?
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Well, not really. Basically the class thatyou pass to the creation of the main Criteria object is the list of object types that you are going to get back. So if you want a list of the other objects make your Criteria object based on that. You can always do joins in a Criteria. Check out at the bottom, the last two pieces of code you see is creating a join.

Good Luck


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Hibernate Criteria
It's not a secret anymore!