HHH-6749: Modified SQLServer2005Dialect.getLimitString() to add limit criteria that uses the max row value in an exclusive manner
This commit is contained in:
parent
7c2d88df8b
commit
d12e0c09ae
|
@ -130,7 +130,7 @@ public class SQLServer2005Dialect extends SQLServerDialect {
|
|||
|
||||
// Wrap the query within a with statement:
|
||||
sb.insert(0, "WITH query AS (").append(") SELECT * FROM query ");
|
||||
sb.append("WHERE __hibernate_row_nr__ BETWEEN ? AND ?");
|
||||
sb.append("WHERE __hibernate_row_nr__ >= ? AND __hibernate_row_nr__ < ?");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
|
@ -1651,10 +1651,10 @@ public class FooBarTest extends LegacyTestCase {
|
|||
.iterate();
|
||||
int count=0;
|
||||
while ( iter.hasNext() ) {
|
||||
System.out.println("ROW = " + iter.next());
|
||||
iter.next();
|
||||
count++;
|
||||
}
|
||||
assertEquals(DIALECT.useMaxForLimit() ? 7 : 4, count);
|
||||
assertEquals(4, count);
|
||||
iter = s.createQuery("select distinct foo from Foo foo")
|
||||
.setMaxResults(2)
|
||||
.setFirstResult(2)
|
||||
|
|
|
@ -64,6 +64,6 @@ public class SQLServer2005DialectTestCase extends BaseUnitTestCase {
|
|||
String input = "select distinct f1 as f53245 from table849752 order by f234, f67 desc";
|
||||
|
||||
Dialect sqlDialect = new SQLServer2005Dialect();
|
||||
assertEquals( "with query as (select row_number() over (order by f234, f67 desc) as __hibernate_row_nr__, f1 as f53245 from table849752 group by f1) select * from query where __hibernate_row_nr__ between ? and ?", sqlDialect.getLimitString(input, 10, 15).toLowerCase() );
|
||||
assertEquals( "with query as (select row_number() over (order by f234, f67 desc) as __hibernate_row_nr__, f1 as f53245 from table849752 group by f1) select * from query where __hibernate_row_nr__ >= ? and __hibernate_row_nr__ < ?", sqlDialect.getLimitString(input, 10, 15).toLowerCase() );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue