Skip to content

Commit

Permalink
Add check on negative pages to exclude pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
uwburn committed Jan 25, 2022
1 parent 0b52166 commit 06a2ffe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<groupId>it.mgt.util</groupId>
<artifactId>jpa-json-search</artifactId>
<version>1.2.4</version>
<version>1.2.5</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/it/mgt/uti/jpajsonsearch/JpaJsonSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ private <V> TypedQuery<V> buildQuery(Class<V> type, boolean count) {
for (Map.Entry<String, Object> e : jpqlAndParams.params.entrySet())
query.setParameter(e.getKey(), e.getValue());

if (!count) {
if (!count & (page >= 0 && pageSize >= 0)) {
query.setMaxResults(pageSize);
query.setFirstResult(page * pageSize);
}
Expand Down

0 comments on commit 06a2ffe

Please sign in to comment.