Use strict H2 query syntax for paging query provider
Simplify tests a bit Updated to snapshot dependencies Updated test and to set the version of h2 to us boot bom.
This commit is contained in:
committed by
Glenn Renfro
parent
65d3510157
commit
a95b420315
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2019 the original author or authors.
|
||||
* Copyright 2016-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,15 +23,17 @@ import org.springframework.data.domain.Pageable;
|
||||
* H2 implementation of a {@link PagingQueryProvider} using database specific features.
|
||||
*
|
||||
* @author Glenn Renfro
|
||||
* @author Henning Pöttker
|
||||
*/
|
||||
public class H2PagingQueryProvider extends AbstractSqlPagingQueryProvider {
|
||||
|
||||
@Override
|
||||
public String getPageQuery(Pageable pageable) {
|
||||
String topClause = new StringBuilder().append("LIMIT ")
|
||||
.append(pageable.getOffset()).append(" ").append(pageable.getPageSize())
|
||||
String limitClause = new StringBuilder().append("OFFSET ")
|
||||
.append(pageable.getOffset()).append(" ROWS FETCH NEXT ")
|
||||
.append(pageable.getPageSize()).append(" ROWS ONLY")
|
||||
.toString();
|
||||
return SqlPagingQueryUtils.generateTopJumpToQuery(this, topClause);
|
||||
return SqlPagingQueryUtils.generateLimitJumpToQuery(this, limitClause);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user