That product a very different query, though

On Thu, Jul 22, 2010 at 8:21 PM, Fabio Maulo <[email protected]> wrote:

> session.Linq<FieldStructure>().Skip(10).Take(10).ToList().Count()
>
>
> On Thu, Jul 22, 2010 at 1:54 PM, Alastair <[email protected]> wrote:
>
>> I'm trying to perform this query on NHibernate 2.1.2 with
>> NHibernate.Linq (1.1.0.1001)
>>
>> session.Linq<FieldStructure>().Skip(10).Take(10).Count()
>>
>> This generates the following SQL
>>
>> "NHibernate: SELECT TOP 10 y0_ FROM (SELECT count(*) as y0_,
>> ROW_NUMBER() OVER(ORDER BY CURRENT_TIMESTAMP) as __hibernate_sort_row
>> FROM FieldStructure this_) as query WHERE query.__hibernate_sort_row >
>> 10 ORDER BY query.__hibernate_sort_row"
>>
>> This query always returns 0 rows, I know I should be getting 10 rows.
>>
>> If I perform the same query without the Count(), I will get 10 rows.
>> The SQL generated is...
>>
>> "NHibernate: SELECT TOP 10 <list of fields>, ROW_NUMBER() OVER(ORDER
>> BY CURRENT_TIMESTAMP) as __hibernate_sort_row FROM FieldStructure
>> this_ left outer join Lookup lookup2_ on
>> this_.LookupId=lookup2_.LookupId) as query WHERE
>> query.__hibernate_sort_row > 10 ORDER BY query.__hibernate_sort_row"
>>
>> Is this a bug?
>>
>> Thanks
>>
>> Alastair
>
>
>
>
> --
> Fabio Maulo
>
>

Reply via email to