• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate Criteria

 
Pradeep Chandrasekharan Nair
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 http://www.javalobby.org/articles/hibernatequery102/ at the bottom, the last two pieces of code you see is creating a join.

Good Luck

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic