-
Notifications
You must be signed in to change notification settings - Fork 933
Closed
Description
When using JoinEntityAlias
with queryOver.RowCount()
or queryOver.ToRowCountQuery()
throws an error
Exception thrown: 'NHibernate.QueryException' in NHibernate.dll
An exception of type 'NHibernate.QueryException' occurred in NHibernate.dll but was not handled in user code
could not resolve property: child2 of: Namespace.To.Child1
Example
Let's say I have 3 classes Parent, Child1, and Child2.
Both childs have a property Parent referencing Parent class
And I'd like to join between Child1 and Child2 using the parent property
Child1 child1 = null;
Child2 child2 = null;
var query = session
.QueryOver(() => child1)
.JoinEntityAlias(
() => child2,
() => child2.Parent.Id == child1.Parent.Id,
NHibernate.SqlCommand.JoinType.InnerJoin
)
;
// [ ... ] // ommitted code for brevity
query // pagination
.Skip(20)
.take(10)
;
query.List(); // returns the correct list paginated
query.RowCount(); // throws the error above
query.ToRowCountQuery().SingleOrDefault<int>(); // throws the same error
Notes
- I'm using Future for this, the same issue occurs
- both
RowCount()
andToRowCountQuery()
work fine with JoinAlias - I haven't tested
JoinEntityQueryOver()
, but I believe the same issue applies