-->
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.  [ 3 posts ] 
Author Message
 Post subject: how to join a table to itself with the Criteria API ?
PostPosted: Wed Dec 13, 2006 2:22 pm 
Newbie

Joined: Wed Dec 13, 2006 1:48 pm
Posts: 2
I would like to do this with the Criteria API (HB 3.0.2) :

select * from MYTABLE t
where t.NAME like 'DO%' and t.ADATE in (
select max(st.ADATE) from MYTABLE st where st.NAME=t.NAME);

Is it possible with the Criteria API ?

thanks !

Fred


Top
 Profile  
 
 Post subject: Detached Criteria
PostPosted: Wed Dec 13, 2006 6:33 pm 
Newbie

Joined: Wed Dec 06, 2006 6:30 pm
Posts: 8
Did you take a look at detached criteria?

http://www.hibernate.org/hib_docs/v3/reference/en/html/querycriteria.html#querycriteria-detachedqueries

-David[/url]


Top
 Profile  
 
 Post subject: Re: Detached Criteria
PostPosted: Thu Dec 14, 2006 2:17 pm 
Newbie

Joined: Wed Dec 13, 2006 1:48 pm
Posts: 2
I did not realize that those DetachedCriteria API could be useful to do subqueries.
It works perfectly well !

thank you so much !

Fred

dsiefert wrote:


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.