Not including the join would break the contract (mapping) that has been defined. While it would be nice to have this as an option, I really don't think that it's a shortcoming of NHibernate. To get the best SQL queries possible, plain SQL should be used.
/G 2011/10/26 Joseph Lam <[email protected]> > I really hope NH can support this. The whole idea of ORM is to provide > goodness of OO such as inheritance/polymorphism. Not having ability to > precisely control the level of inheritance in queries can cause > significant unneeded performance overhead, especially for more complex > OO scenarios which is where we need NH the most. > > On Oct 24, 8:46 pm, Marios Skounakis <[email protected]> wrote: > > I don't think that there is way other than sql to do what you want. > > > > > > > > > > > > > > > > On Mon, Oct 24, 2011 at 18:07, brandon law <[email protected]> wrote: > > > I'm trying to select count for a superclass that has a lot of records. > The > > > select is joining all the subclasses( about 4 tables) that inherit from > the > > > super. > > > I use Fluent NHibernate to map the classes with SubClassMap. > > > > > How can I select only the superclass? > > > Thanks in advance! > > > > > setup: > > > > > /*------------------------------------------------------ > > > CLASSES > > > ------------------------------------------------------*/ > > > public class Subscriber > > > { > > > public virtual Guid Id {get;set;} > > > public virutal string UserName {get;set;} > > > > > } > > > > > public class Organization : Subscriber > > > { > > > public virtual string Name {get;set;} > > > } > > > > > I'm trying this to get the count of subscribers where > Subscriber.username = > > > variable.. > > > > > /*------------------------------------------------------ > > > DAL > > > ------------------------------------------------------*/ > > > var count = session.CreateCriteria<Subscriber>() > > > .Add(Restrictions.Eq("WwwUsername", login)) > > > > > .SetProjection(Projections.Count("WwwUsername")).UniqueResult(); > > > > > -- > > > You received this message because you are subscribed to the Google > Groups > > > "nhusers" group.> To post to this group, send email > [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. > > -- > 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. > > -- 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.
