is Age a mapped property? or is a readonly property that use other property?
2011/5/2 Vikas Roonwal <[email protected]>: > Hi, > > I am using NHibernate 3.1.0 and have a domain object similar to > > SystemUser > { > SystemId, > SystemCredential, > Person > { > Age > Name > { > FirstName > LastName > } > } > } > > Using NHibernateSession.Query<SystemUser> I can query based on any of the > contained objects i.e. Where(su=>su.Person.Age>35) would work. > > How do I tell NHibernate to sort using one of the inner values, something > like var Qu = NHibernateSession.Query<SystemUser>(); > Qu.OrderBy(su=>su.Person.Age) > > Doing the order by gives the following error: > > Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. > [.Take[Test.SystemServices.Persistence.SystemUser](.Skip[Test.SystemServices.Persistence.SystemUser](.OrderBy[Test.SystemServices.Persistence.SystemUser,System.Object](.OrderBy[Test.SystemServices.Persistence.SystemUser,System.Object](.Where[Test.SystemServices.Persistence.SystemUser](.Where[Test.SystemServices.Persistence.SystemUser](.Where[Test.SystemServices.Persistence.SystemUser](.Where[Test.SystemServices.Persistence.SystemUser](NHibernate.Linq.NhQueryable`1[Test.SystemServices.Persistence.SystemUser], > Quote((x, ) => (Equal(x.StatusE, p1))), ), Quote((x, ) => > (Equal(x.ActiveInactiveE, p2))), ), Quote((x, ) => > (OrElse(OrElse(.Any[Test.SystemServices.Persistence.EpisodeDO](x.Episodes, > (e, ) => (Equal(e.ManagerId, p3)), ), > .Any[Test.SystemServices.Persistence.EpisodeDO](x.Episodes, (y, ) => > (.Any[Test.SystemServices.Persistence.EpisodeManagerDO](y.EpisodeManagers, > (z, ) => (Equal(z.ManagerId, p4)), )), )), > .Any[Test.SystemServices.Persistence.UserTrackerDO](x.Trackers, (t, ) => > (AndAlso(OrElse(AndAlso(NotEqual(t.AssignedUserId, NULLp5), > Equal(t.AssignedUserId, p6)), AndAlso(NotEqual(t.AssignedGroupId, NULLp7), > p8.Contains(Convert(t.AssignedGroupId), ))), NotEqual(t.TrackerSubStatus, > p9))), )))), ), Quote((x, ) => > (.Any[Test.SystemServices.Persistence.EpisodeDO](x.Episodes, (y, ) => > (Equal(y.IsLatest, p10)), ))), ), Quote((x, ) => > (.First[Test.SystemServices.Persistence.PersonNameDO](x.Person.PersonNames, > ).FamilyName)), ), Quote((x, ) => > (.First[Test.SystemServices.Persistence.PersonNameDO](x.Person.PersonNames, > ).GivenName)), ), p11, ), p12, )] at > NHibernate.Hql.Ast.ANTLR.ErrorCounter.ThrowQueryException() > at NHibernate.Hql.Ast.ANTLR.HqlSqlTranslator.Translate() > at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.DoCompile(IDictionary`2 > replacements, Boolean shallow, String collectionRole) > at > NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(IASTNode > ast, String queryIdentifier, String collectionRole, Boolean shallow, > IDictionary`2 filters, ISessionFactoryImplementor factory) > at > NHibernate.Hql.Ast.ANTLR.ASTQueryTranslatorFactory.CreateQueryTranslators(String > queryIdentifier, IQueryExpression queryExpression, String collectionRole, > Boolean shallow, IDictionary`2 filters, ISessionFactoryImplementor factory) > at > NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(IQueryExpression > queryExpression, Boolean shallow, IDictionary`2 enabledFilters) > at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(IQueryExpression > queryExpression, Boolean shallow) > at NHibernate.Impl.AbstractSessionImpl.CreateQuery(IQueryExpression > queryExpression) > at NHibernate.Linq.NhQueryProvider.PrepareQuery(Expression expression, > IQuery& query, NhLinqExpression& nhQuery) > at NHibernate.Linq.NhQueryProvider.Execute[TResult](Expression > expression) > at Remotion.Data.Linq.QueryableBase`1.GetEnumerator() > at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) > at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) > > Any help is greatly appreciated. > > Thanks, > ~Vikas > > -- > 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.
