-->
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.  [ 2 posts ] 
Author Message
 Post subject: how to retrieve data from two tables with criteria query
PostPosted: Fri Sep 14, 2007 5:19 pm 
Newbie

Joined: Fri Sep 14, 2007 4:56 pm
Posts: 1
Hi all,

i want to fetch data from two tables by joining three tables.

My tables association is like -

one servicer has many deals. and one deal has many loans.

I want to get all column from loan table and servicer name from servicer table.

this is done with normal hql as

select <properties> from Loan l, servicer s, deal d where
l.key = d.key1
d.key2 = s.key.

In this query <properties> contains columns from loan and servicer.

But how do i fetch same records from two tables through Criteria query.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 15, 2007 4:47 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
You will have to create two alias.

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


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

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.