Also asked at stackoverflow site: http://stackoverflow.com/questions/39493202/nhibernate-queryover-with-subquery-using-parent-root-alias-could-not-resolve
I'm trying to write QueryOver with subquery, which references root query property inside it using this code: Entity root = null;var query = Session.QueryOver(() => root);var subQuery = QueryOver.Of<Entity>(); subQuery.Where((x) => x.Id == root.Id).Select(Projections.RowCount()); query.WithSubquery.WhereValue(0).Eq(subQuery); query.List(); This doesn't work, because: NHibernate.QueryException: could not resolve property: root of: Entity -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+unsubscr...@googlegroups.com. To post to this group, send email to nhusers@googlegroups.com. Visit this group at https://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.