Hey Derek,
I have got exact the same issue. When calling setMaxResult the schema, table- and column-names generated after are lower case. In my case this causes an error, because some of our databases working case sensitive and then this query causes a SQLServerException:
Code:
com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'schema.view'.
This is the working SQL-Statement:
Code:
WITH query AS (select ROW_NUMBER() OVER (order by this_.LOG_TIME desc) as __hibernate_row_nr__, this_.LOG_TIME as log1_12_0_, this_.CMDUSER as cmduser12_0_, this_.MESSAGE as message12_0_, this_.MSG_ID as msg4_12_0_ from SCHEMA.VIEW this_ ) SELECT * FROM query WHERE __hibernate_row_nr__ BETWEEN ? AND ?
This is the generated SQL when using setMaxResult:
Code:
WITH query AS (select ROW_NUMBER() OVER (order by this_.log_time desc) as __hibernate_row_nr__, this_.log_time as log1_12_0_, this_.cmduser as cmduser12_0_, this_.message as message12_0_, this_.msg_id as msg4_12_0_ from schema.view this_ ) SELECT * FROM query WHERE __hibernate_row_nr__ BETWEEN ? AND ?
Java: JDK 1.6.0_24
Hibernate: 3.6.8.Final
Database: SQL Server 2008 R2
Has anyone a working solution for this issue?
Best regards,
Julian