-->
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: Both the entity and scalar values in one Criteria Query
PostPosted: Sat Apr 14, 2007 10:10 am 
Newbie

Joined: Sat Apr 07, 2007 12:08 pm
Posts: 6
How do I use Criteria API to get both the root entity and some scalar values in one query? It seems that as soon as setProjection() is used, the root entity object is no longer retrieved (and there doesn't seem to be any Projection to fix that).

Example:

Code:
select cat, sum(kitten.weight) from Cat cat
join cat.kittens kitten
group by cat

How do I make such a query using Criteria API? Listing all cat's properties doesn't seem like an elegant solution and it won't create a Cat object for me.


Top
 Profile  
 
 Post subject: I'm looking for an answer for this too
PostPosted: Fri Oct 05, 2007 12:56 pm 
Newbie

Joined: Fri Oct 05, 2007 3:27 am
Posts: 4
It seems that it is impossible...

_________________
--
-jarppe


Top
 Profile  
 
 Post subject: I'm looking for an answer for this too
PostPosted: Fri Oct 05, 2007 12:57 pm 
Newbie

Joined: Fri Oct 05, 2007 3:27 am
Posts: 4
It seems that it is impossible...

_________________
--
-jarppe


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.