I have these working queries:
var movieCountQuery = session.QueryOver<Movie>()
.Select(list => list
.SelectCount(m => m.Id));
var moviePageQuery = session.QueryOver<Movie>()
.Skip((pageNumber - 1) * pageSize)
.Take(pageSize);
var multiCrit = session.CreateMultiCriteria()
.Add<int>("count", movieCountQuery.UnderlyingCriteria)
.Add<Movie>("page", moviePageQuery.UnderlyingCriteria);
var countResult = ((IList<int>)multiCrit
.GetResult("count")).First();
var pageResult = (IList<Movie>) multiCrit
.GetResult("page");
vs. the same thing in HQL:
var movieCountQuery = session.CreateQuery(
@"select count(m.Id) from Movie m");
var moviePageQuery = session.CreateQuery(
@"from Movie m")
.SetFirstResult((pageNumber - 1) * pageSize)
.SetMaxResults(pageSize);
var mq = session.CreateMultiQuery()
.Add<Int64>("count", movieCountQuery)
.Add<Movie>("page", moviePageQuery);
var countResult = ((IList<Int64>)mq
.GetResult("count")).First();
var pageResult = (IList<Movie>)mq
.GetResult("page");
I doubt this is related to multicriteria or multiquery, but I haven't taken
the time to isolate it yet. When I switch the Criteria count query to Int64,
it blows up. When I switch the HQL count query to Int32, it blows up.
Does anyone know why these return different size integers?
Thanks,
Jason
--
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.