We're updating the issue view to help you get more done. 

Update SQLServer2005LimitHandler to handle multiselects (*, table.*)

Description

PagingAndLockingTest#testNativeSql on MSSQL

If only setFirstResult is used, this query results:

1 2 3 4 select * from door

With only setMaxResults, this query results:

1 2 3 4 select TOP(?) * from door

With both, the following:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 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:

1 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.

Environment

None

Status

Assignee

Brett Meyer

Reporter

Brett Meyer

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Priority

Major