HQL returns Int64 since long time ago. Criteria has 2 methods because back draw-compatibility RowCount and RowCountInt64
Probably in QueryOver the method in use is RowCount. On Fri, Apr 23, 2010 at 6:48 PM, Tuna Toksoz <[email protected]> wrote: > seemed like a bug. > > Tuna Toksöz > Eternal sunshine of the open source mind. > > http://devlicio.us/blogs/tuna_toksoz > http://tunatoksoz.com > http://twitter.com/tehlike > > > > > > On Sat, Apr 24, 2010 at 12:40 AM, Jason Dentler <[email protected]>wrote: > >> 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]<nhusers%[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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > -- Fabio Maulo -- 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.
