I don't think the Criteria API is well suited for this*... maybe you can
make it work with SqlProjection, but it would be ugly.
Is there any reason why you want to use Criteria and not HQL in this case?

   Diego

*: I might be wrong. Maybe there's a way to do it, but I don't know it.


On Tue, Apr 6, 2010 at 08:09, Husain <[email protected]> wrote:

> Hi,
>
> I am trying to build a report query using Criteria API. The query in
> HQL which is pasted below gives me the correct results.
>
> select s.Id, s.Name, sum(q.PointsObtained), sum(q.TotalPoints)
> from Student s
> join s.Questionnaire q
> group by s.Id, s.Name
> order by (sum(q.PointsObtained) / sum(q.TotalPoints)) desc
>
> How can I write the ORDER BY bit of the HQL in Criteria API?
>
> Thanks,
> Husain
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to