It makes sense then... in that case, you'll have to either use SqlProjection or implement your own IProjection. That would be interesting to see so, if you do that, please share :-)
Diego On Tue, Apr 6, 2010 at 09:58, Husain <[email protected]> wrote: > The query I posted is a simplified version of what I am trying to do. > In my application the WHERE clause is constructed by various filters > as per the user's selection. So using the Criteria API gives me the > cleanest and most readable code. I'd have to bend over backwards to > get a dynamically generated HQL query. > > > On Apr 6, 4:13 pm, Diego Mijelshon <[email protected]> wrote: > > 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]> > <nhusers%[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]<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.
