-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Criteria queries and joins
PostPosted: Mon Mar 28, 2005 9:06 pm 
Newbie

Joined: Mon Mar 28, 2005 8:49 pm
Posts: 3
[b]Hibernate version:[/b] 2.x

I'm having a lot of difficulty working out how to do joins using criteria queries. My understanding of criteria queries is that when you call createCriteria(class), the class you give it is the persistant class that you want the data to be returned as an instance of. I want to do a query that returns a list of objects that contains data from two different tables, associated by an inner join.

As an example, if I have two tables with the attributes:
PERSON
- personId
- name
- departmentId

DEPARTMENT
- departmentId
- name
And I have an object that will go to my web front end that contains the following data to be rendered:

Webform
- personName
- departmentName

how do i use criteria queries to return a list of Webform's created by an SQL query that joins person to department by departmentid?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.