Issue Type: Bug Bug
Assignee: Brett Meyer
Created: 14/Feb/13 2:32 PM
Description:

PagingAndLockingTest#testNativeSql on MSSQL

If only setFirstResult is used, this query results:

select
        * 
    from
        door

With only setMaxResults, this query results:

select
        TOP(?) * 
    from
        door

With both, the following:

WITH query AS (SELECT
        inner_query.*,
        ROW_NUMBER() OVER (
    ORDER BY
        CURRENT_TIMESTAMP) as __hibernate_row_nr__ 
    FROM
        ( select
            * as page0_ 
        from
            door ) inner_query ) SELECT
            page0_ 
        FROM
            query 
        WHERE
            __hibernate_row_nr__ >= ? 
            AND __hibernate_row_nr__ < ?

That last query fails with the following exception:

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'as'.

I'm not sure which 'as' it's complaining about, nor am I sure exactly how that query is working.

Project: Hibernate ORM
Priority: Major Major
Reporter: Brett Meyer
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira