This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
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

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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: 17249

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 - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Hibernate Criteria
Similar Threads
fetching records by using hql and criteria is taking more time
how do you interview?
Duplicate results in Hibernate many to many mapping.
greatest rock band ever?
Bangalore-India Java/J2EE 1-4 Yrs