diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7a7bb8d..0a8a313 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -13,9 +13,7 @@ jobs:
strategy:
matrix:
jdk-version:
- - 8
- - 11
- - 14
+ - 17
steps:
- name: Checkout repository
@@ -29,7 +27,7 @@ jobs:
cache: maven
- name: Test with Maven
- run: mvn test
+ run: mvn -B test
test-postgres:
runs-on: ubuntu-latest
@@ -51,10 +49,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- - name: Set up JDK 14
+ - name: Set up JDK 17
uses: actions/setup-java@v3
with:
- java-version: 14
+ java-version: 17
distribution: adopt
cache: maven
@@ -84,10 +82,10 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- - name: Set up JDK 14
+ - name: Set up JDK 17
uses: actions/setup-java@v3
with:
- java-version: 14
+ java-version: 17
distribution: adopt
cache: maven
diff --git a/pom.xml b/pom.xml
index 4b876b1..7d2ecd8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.github.darrachequesne
spring-data-jpa-datatables
- 5.2.0
+ 6.0.0-SNAPSHOT
Spring Data JPA for DataTables
Spring Data JPA extension to work with the great jQuery plug-in DataTables (http://datatables.net/)
@@ -48,12 +48,12 @@
- 2.5.2
- 1.6.5
- 1.6
+ 3.0.0-M7
+ 1.6.13
+ 3.0.1
- 1.8
+ 17
${java.version}
${java.version}
UTF-8
@@ -64,7 +64,14 @@
org.springframework.boot
spring-boot-dependencies
- 2.6.7
+ 3.0.0
+ pom
+ import
+
+
+ org.junit
+ junit-bom
+ 5.9.1
pom
import
@@ -89,36 +96,40 @@
- javax.validation
- validation-api
+ jakarta.validation
+ jakarta.validation-api
- org.hibernate
- hibernate-entitymanager
+ org.hibernate.orm
+ hibernate-core
+ 6.1.4.Final
-
com.querydsl
querydsl-apt
+ 5.0.0
+ jakarta
com.querydsl
querydsl-jpa
+ 5.0.0
+ jakarta
- javax.annotation
- javax.annotation-api
+ jakarta.annotation
+ jakarta.annotation-api
compile
- junit
- junit
+ org.junit.jupiter
+ junit-jupiter-engine
test
@@ -141,8 +152,8 @@
- mysql
- mysql-connector-java
+ com.mysql
+ mysql-connector-j
test
@@ -154,7 +165,7 @@
org.slf4j
- slf4j-log4j12
+ slf4j-reload4j
test
@@ -164,12 +175,12 @@
com.mysema.maven
- maven-apt-plugin
- 1.0
+ apt-maven-plugin
+ 1.1.3
- test-process
+ process
target/generated-sources/java
@@ -181,7 +192,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.8.1
+ 3.10.1
${maven.compiler.target}
@@ -191,7 +202,7 @@
org.apache.maven.plugins
maven-resources-plugin
- 3.1.0
+ 3.3.0
${source.encoding}
@@ -215,7 +226,7 @@
org.apache.maven.plugins
maven-javadoc-plugin
- 3.2.0
+ 3.4.1
@@ -230,6 +241,12 @@
true
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 3.0.0-M7
+
diff --git a/src/main/java/org/springframework/data/jpa/datatables/ColumnFilter.java b/src/main/java/org/springframework/data/jpa/datatables/ColumnFilter.java
index 9eb1b2f..2b61f4c 100644
--- a/src/main/java/org/springframework/data/jpa/datatables/ColumnFilter.java
+++ b/src/main/java/org/springframework/data/jpa/datatables/ColumnFilter.java
@@ -4,9 +4,9 @@
import com.querydsl.core.types.Predicate;
import com.querydsl.core.types.dsl.*;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.Expression;
-import javax.persistence.criteria.From;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.Expression;
+import jakarta.persistence.criteria.From;
import java.util.HashSet;
import java.util.Set;
@@ -72,7 +72,7 @@ public Predicate createPredicate(PathBuilder> pathBuilder, String attributeNam
}
@Override
- public javax.persistence.criteria.Predicate createPredicate(From, ?> from, CriteriaBuilder criteriaBuilder, String attributeName) {
+ public jakarta.persistence.criteria.Predicate createPredicate(From, ?> from, CriteriaBuilder criteriaBuilder, String attributeName) {
Expression> expression = from.get(attributeName);
if (values.isEmpty()) {
@@ -81,7 +81,7 @@ public javax.persistence.criteria.Predicate createPredicate(From, ?> from, Cri
return super.createPredicate(from, criteriaBuilder, attributeName);
}
- javax.persistence.criteria.Predicate predicate;
+ jakarta.persistence.criteria.Predicate predicate;
if (isBooleanComparison) {
predicate = expression.in(booleanValues);
} else {
diff --git a/src/main/java/org/springframework/data/jpa/datatables/Filter.java b/src/main/java/org/springframework/data/jpa/datatables/Filter.java
index 35a1db2..a69de00 100644
--- a/src/main/java/org/springframework/data/jpa/datatables/Filter.java
+++ b/src/main/java/org/springframework/data/jpa/datatables/Filter.java
@@ -2,9 +2,9 @@
import com.querydsl.core.types.dsl.PathBuilder;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.From;
-import javax.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.From;
+import jakarta.persistence.criteria.Predicate;
interface Filter {
diff --git a/src/main/java/org/springframework/data/jpa/datatables/GlobalFilter.java b/src/main/java/org/springframework/data/jpa/datatables/GlobalFilter.java
index 8857fe6..264aa00 100644
--- a/src/main/java/org/springframework/data/jpa/datatables/GlobalFilter.java
+++ b/src/main/java/org/springframework/data/jpa/datatables/GlobalFilter.java
@@ -5,10 +5,10 @@
import com.querydsl.core.types.dsl.PathBuilder;
import com.querydsl.core.types.dsl.StringOperation;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.Expression;
-import javax.persistence.criteria.From;
-import javax.persistence.criteria.Predicate;
+import jakarta.persistence.criteria.CriteriaBuilder;
+import jakarta.persistence.criteria.Expression;
+import jakarta.persistence.criteria.From;
+import jakarta.persistence.criteria.Predicate;
/**
* Filter which creates a basic "WHERE ... LIKE ..." clause
diff --git a/src/main/java/org/springframework/data/jpa/datatables/SpecificationBuilder.java b/src/main/java/org/springframework/data/jpa/datatables/SpecificationBuilder.java
index ea40fe3..c80aff6 100644
--- a/src/main/java/org/springframework/data/jpa/datatables/SpecificationBuilder.java
+++ b/src/main/java/org/springframework/data/jpa/datatables/SpecificationBuilder.java
@@ -1,11 +1,11 @@
package org.springframework.data.jpa.datatables;
-import org.hibernate.query.criteria.internal.path.AbstractPathImpl;
+import jakarta.persistence.metamodel.Bindable.BindableType;
import org.springframework.data.jpa.datatables.mapping.DataTablesInput;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.lang.NonNull;
-import javax.persistence.criteria.*;
+import jakarta.persistence.criteria.*;
import java.util.ArrayList;
import java.util.List;
@@ -20,12 +20,12 @@ public Specification build() {
}
private class DataTablesSpecification implements Specification {
- private List columnPredicates = new ArrayList<>();
- private List globalPredicates = new ArrayList<>();
+ protected List columnPredicates = new ArrayList<>();
+ protected List globalPredicates = new ArrayList<>();
@Override
public Predicate toPredicate(@NonNull Root root, @NonNull CriteriaQuery> query, @NonNull CriteriaBuilder criteriaBuilder) {
- initPredicatesRecursively(tree, root, root, criteriaBuilder);
+ initPredicatesRecursively(query, tree, root, root, criteriaBuilder);
if (input.getSearchPanes() != null) {
input.getSearchPanes().forEach((attribute, values) -> {
@@ -35,15 +35,16 @@ public Predicate toPredicate(@NonNull Root root, @NonNull CriteriaQuery> qu
});
}
- boolean isCountQuery = query.getResultType() == Long.class;
- if (isCountQuery) {
- root.getFetches().clear();
- }
+ final Predicate predicate = createFinalPredicate(criteriaBuilder);
+ columnPredicates.clear();
+ return predicate;
+ }
- return createFinalPredicate(criteriaBuilder);
+ private boolean isCountQuery(CriteriaQuery> query) {
+ return query.getResultType() == Long.class;
}
- private void initPredicatesRecursively(Node node, From from, FetchParent fetch, CriteriaBuilder criteriaBuilder) {
+ protected void initPredicatesRecursively(CriteriaQuery> query, Node node, From from, FetchParent fetch, CriteriaBuilder criteriaBuilder) {
if (node.isLeaf()) {
boolean hasColumnFilter = node.getData() != null;
if (hasColumnFilter) {
@@ -56,23 +57,26 @@ private void initPredicatesRecursively(Node node, From from, Fetch
}
for (Node child : node.getChildren()) {
Path