-->
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.  [ 4 posts ] 
Author Message
 Post subject: Subselect in SELECT clause with Criteria Query
PostPosted: Fri Aug 20, 2010 5:08 pm 
Newbie

Joined: Tue Jun 15, 2010 10:14 am
Posts: 3
Example from HQL documentation showing a Subselect in SELECT clause:
Code:
select cat.id, (select max(kit.weight) from cat.kitten kit)from Cat as cat


Can this be done with the Criteria query api?
An example or hint as to where to look in the api would be greatly appreciated. Thanks


Top
 Profile  
 
 Post subject: Re: Subselect in SELECT clause with Criteria Query
PostPosted: Sun Aug 22, 2010 5:33 pm 
Newbie

Joined: Tue Jun 15, 2010 10:14 am
Posts: 3
I believe that what I need is a Projection. I don't see a built-in one in the Projections factory, but I am guessing that if the API can generate the SQL for subqueries in the WHERE clause it would not be much work to extend in to the SELECT and/or FROM clause.

I am going to give it a shot. Any help or suggestions would be appreciated. Especially if someone has already done this.

Thanks,


Top
 Profile  
 
 Post subject: Re: Subselect in SELECT clause with Criteria Query
PostPosted: Mon Aug 23, 2010 4:56 am 
Beginner
Beginner

Joined: Thu Dec 11, 2008 8:18 am
Posts: 35
check this post, probably give some information.
viewtopic.php?t=955642


Top
 Profile  
 
 Post subject: Re: Subselect in SELECT clause with Criteria Query
PostPosted: Mon Aug 23, 2010 1:21 pm 
Newbie

Joined: Tue Jun 15, 2010 10:14 am
Posts: 3
I checked out the thread, I scanned through and it seems to discuss subqueries in the where clause, while i am looking for a subquery in the select clause. I read it quickly so might have missed something that might help.


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