@Olivier, @Fabio - thanks. I will give each of those a try (hacking the table name, vs. doing it at query time).
On Mar 6, 7:51 am, Olivier Coanet <[email protected]> wrote: > Colin, > > If performance is not your main concern, you can use the following hack : > WithTableName("(select distinct * from V_UserApplicationPermissions)") > > > > On Sat, Mar 6, 2010 at 3:57 AM, Fabio Maulo <[email protected]> wrote: > > select distinct u from User u where u.Id = :thisIsAbergamotta > > > 2010/3/5 Colin Bowern <[email protected]> > > > I have an existing view which has too much data in it. Unfortunately I > >> cannot get rid of it so I need to try to work around it using my > >> NHibernate mapping. The idea is to have NH issue the following query: > > >> SELECT DISTINCT User_Id, Module_Id, Application_Id, RightsMask > >> FROM V_UserApplicationPermissions > >> WHERE User_Id = ? > > >> My current mapping for this list of AccessControlEntry types looks > >> like this: > > >> HasMany<AccessControlEntry>(x => x.Rights) > >> .WithTableName("V_UserApplicationPermissions") > >> .KeyColumnNames.Add("User_Id") > >> .Component(c => > >> { > >> c.Map(x => x.Module, "Module_Id"); > >> c.Map(x => x.Application, "App_Id"); > >> c.Map(x => x.Rights, > >> "RightsMask").CustomTypeIs<ApplicationRightsType>(); > >> }) > >> .Not.LazyLoad(); > > >> Any thoughts on how to have NHibernate put a DISTINCT keyword in there > >> during the query? > > >> -- > >> 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. > > > -- > > Fabio Maulo > > > -- > > 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.- Hide quoted text - > > - Show quoted text - -- 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.
