Thanks for the response! The way I understand formula fields is they are defined in the HBM xml file and are essentially static.
Sure I could define forumula="case when Priority='High' then 0 else 1" the problem is sometimes I might want the formula to be formula="case when Priority='Low' then 0 else 1'. The formula can change based on how my users filter their criteria. I can't anticipate all the different ways the user will filter and want their data sorted. Does this make sense? On Feb 11, 4:59 pm, 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 - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
