-->
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: How to write in Inner Joins using Criteria API
PostPosted: Tue Nov 06, 2007 8:56 am 
Newbie

Joined: Thu Nov 02, 2006 11:23 pm
Posts: 4
Hi All:

I have two tables which are mapped independently in the hbm.xml Files. They donot have any kind of one to one or many-to many etc relationship specified in Mapping.

I would like to do something like the following using an Inner Join with the Criteria APIs:

select tab1.* from TABLE_1 tab1, TABLE_2 tab2 where tab1.licenceNumber = tab2.licenceNumber and tab2.score > 50

The result of the ArrayList produced must give me an ArrayList of the Table_1 Class.

Can anyone pls give me the syntax using Criteria API.

So far my search in google and other books has given me the Impression that inner joins are only possible when the Objects have a has-a relationship with one another.

Pls tell me if this is so - in which case I cannot write an INNER JOIN for the above SQL using Criteria API.

Thanks.

Chetan

PS. If Criteria cannot be used I am ok with HQL.


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.