you can use SQL for this one, with the expansion syntax:
SELECT
CASE
WHEN Priority = 'High' THEN 0
ELSE 1
END AS BatchPrioritySort,
*{t.*}*
FROM
TranslationBatch *AS t*
ORDER BY BatchPrioritySort ASC
On Thu, Feb 12, 2009 at 12:59 AM, John Rayner <[email protected]>wrote:
>
> Don't think I follow your reasons why you can't have a formula field.
> It looks to me like that would be the way forward here.
>
> On Feb 11, 2:47 pm, RDot <[email protected]> wrote:
> > Hi -
> >
> > nhibernate version: 1.2.1.4000
> > SQL Server 2005
> > C# 2.0
> >
> > If you use Projections when using the Criteria API can you still
> > populate the regular entity object?
> >
> > I want to add a new field in my select statement which I can then
> > order by but I also want to populate the entity object.
> >
> > I have read the documentation and browsed the web and it appears
> > whenever you use projections you are now working with an IList.
> >
> > The sample SQL I need is something along this line...
> >
> > select case when Priority = 'High' then 0 else 1
> > end AS BatchPrioritySort, *
> > from TranslationBatch
> > order by BatchPrioritySort ASC
> >
> > So I want a List<TranslationBatch> objects returned. I can't use
> > a formula field because sometimes the 'case when' clause will sort
> > differently based on different priority values. I want to use the
> > Criteria API because I build a long Where clause based on fields the
> > user has filtered on.
> >
> > I have researched and tried to make the SetResultTransformer work
> > to no avail.
> >
> > This seems very simple, am I missing something?
> >
> > Thanks -
> >
>
--
Ken Egozi.
http://www.kenegozi.com/blog
http://www.delver.com
http://www.musicglue.com
http://www.castleproject.org
http://www.gotfriends.co.il
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---