diff --git a/README.md b/README.md
index 9890b49..b4b9a48 100644
--- a/README.md
+++ b/README.md
@@ -1,42 +1,48 @@
# specification-with-projection
Support Projections with `JpaSpecificationExecutor.findAll(Specification,Pageable)` for Spring Data JPA
->version 2.x.x for Spring Data JPA 2.x (Spring Boot 2.x)
+>version 2.x.x for Spring Data JPA 2.x (Spring Boot 2.x)
->version 1.x.x Spring Data JPA 1.x
+>version 1.x.x Spring Data JPA 1.x
## How to use
* add dependency to pom
```xml
-
+
- th.co.geniustree.springdata.jpa
- specification-with-projections
- 2.0.1
+ th.co.geniustree.springdata.jpa
+ specification-with-projections
+ 3.0.0
+
+
+
+th.co.geniustree.springdata.jpa
+specification-with-projections
+2.0.1
```
```xml
- th.co.geniustree.springdata.jpa
- specification-with-projections
- 1.0.6
+ th.co.geniustree.springdata.jpa
+ specification-with-projections
+ 1.0.6
```
* add annotation `@EnableJpaRepositories(repositoryBaseClass = JpaSpecificationExecutorWithProjectionImpl.class)` on Application class (Spring Boot)
* create your repository and extends `JpaSpecificationExecutorWithProjection`
```java
public interface DocumentRepository extends JpaRepository,JpaSpecificationExecutorWithProjection {
- /**
- * projection interface
- **/
- public static interface DocumentWithoutParent{
- Long getId();
- String getDescription();
- String getDocumentType();
- String getDocumentCategory();
- List getChild();
- }
+ /**
+ * projection interface
+ **/
+ public static interface DocumentWithoutParent{
+ Long getId();
+ String getDescription();
+ String getDocumentType();
+ String getDocumentCategory();
+ List getChild();
+ }
}
```
* use it
@@ -50,12 +56,12 @@ public interface DocumentRepository extends JpaRepository,JpaS
}
```
* version 1.0.3 RELEASE add support for @NamedEntityGraph and AD-HOC entity graph (via JpaEntityGraph)
-http://docs.spring.io/spring-data/jpa/docs/1.10.4.RELEASE/reference/html/#jpa.entity-graph
+ http://docs.spring.io/spring-data/jpa/docs/1.10.4.RELEASE/reference/html/#jpa.entity-graph
```java
JpaEntityGraph jpaEntityGraph = new JpaEntityGraph(
- "birth.sistRecvTm",
- EntityGraph.EntityGraphType.FETCH,
- new String[]{"sistRecvTm","birth","transfer","merger"}
- );
- BirthWithoutChild birth = birthRepository.findAll(createSpecBirth(searchData, type.toUpperCase()), BirthWithoutChild.class,jpaEntityGraph,pageable);
+ "birth.sistRecvTm",
+ EntityGraph.EntityGraphType.FETCH,
+ new String[]{"sistRecvTm","birth","transfer","merger"}
+ );
+ BirthWithoutChild birth = birthRepository.findAll(createSpecBirth(searchData, type.toUpperCase()), BirthWithoutChild.class,jpaEntityGraph,pageable);
```
diff --git a/pom.xml b/pom.xml
index d24b119..e40becb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,7 +13,7 @@
org.springframework.boot
spring-boot-starter-parent
- 2.5.1
+ 3.0.4
@@ -74,11 +74,11 @@
org.hibernate
hibernate-jpamodelgen
provided
+ 6.1.7.Final
org.projectlombok
lombok
- 1.18.4
provided
@@ -87,7 +87,7 @@
maven-compiler-plugin
- 3.5.1
+ 3.8.1
diff --git a/src/main/java/org/springframework/data/repository/query/TupleConverter.java b/src/main/java/org/springframework/data/repository/query/TupleConverter.java
index a32a112..2dad944 100644
--- a/src/main/java/org/springframework/data/repository/query/TupleConverter.java
+++ b/src/main/java/org/springframework/data/repository/query/TupleConverter.java
@@ -4,8 +4,8 @@
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
-import javax.persistence.Tuple;
-import javax.persistence.TupleElement;
+import jakarta.persistence.Tuple;
+import jakarta.persistence.TupleElement;
import java.util.*;
import java.util.stream.Collectors;
@@ -48,7 +48,7 @@ public Object convert(Object source) {
}
}
- return new TupleConverter.TupleBackedMap(tuple);
+ return new TupleBackedMap(tuple);
}
/**
diff --git a/src/main/java/th/co/geniustree/springdata/jpa/repository/support/DefaultQueryHints.java b/src/main/java/th/co/geniustree/springdata/jpa/repository/support/DefaultQueryHints.java
index 6e9fb0a..5aa142a 100644
--- a/src/main/java/th/co/geniustree/springdata/jpa/repository/support/DefaultQueryHints.java
+++ b/src/main/java/th/co/geniustree/springdata/jpa/repository/support/DefaultQueryHints.java
@@ -25,7 +25,7 @@
import org.springframework.data.util.Optionals;
import org.springframework.util.Assert;
-import javax.persistence.EntityManager;
+import jakarta.persistence.EntityManager;
import java.util.*;
import java.util.function.BiConsumer;
@@ -109,7 +109,7 @@ private QueryHints combineHints() {
return QueryHints.from(forCounts ? metadata.getQueryHintsForCount() : metadata.getQueryHints(), getFetchGraphs());
}
- private org.springframework.data.jpa.repository.support.QueryHints getFetchGraphs() {
+ private QueryHints getFetchGraphs() {
return Optionals
.mapIfAllPresent(entityManager, metadata.getEntityGraph(),
(em, graph) -> Jpa21Utils.getFetchGraphHint(em, getEntityGraph(graph), information.getJavaType()))
diff --git a/src/main/java/th/co/geniustree/springdata/jpa/repository/support/JpaSpecificationExecutorWithProjectionImpl.java b/src/main/java/th/co/geniustree/springdata/jpa/repository/support/JpaSpecificationExecutorWithProjectionImpl.java
index 81995b7..7542bf9 100644
--- a/src/main/java/th/co/geniustree/springdata/jpa/repository/support/JpaSpecificationExecutorWithProjectionImpl.java
+++ b/src/main/java/th/co/geniustree/springdata/jpa/repository/support/JpaSpecificationExecutorWithProjectionImpl.java
@@ -20,24 +20,24 @@
import org.springframework.data.repository.query.ReturnTypeWarpper;
import org.springframework.data.repository.query.ReturnedType;
import org.springframework.data.repository.query.TupleConverter;
-import org.springframework.data.repository.support.PageableExecutionUtils;
+import org.springframework.data.support.PageableExecutionUtils;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import th.co.geniustree.springdata.jpa.repository.JpaSpecificationExecutorWithProjection;
-import javax.persistence.*;
-import javax.persistence.criteria.*;
-import javax.persistence.metamodel.Attribute;
-import javax.persistence.metamodel.Bindable;
-import javax.persistence.metamodel.ManagedType;
-import javax.persistence.metamodel.PluralAttribute;
+import jakarta.persistence.*;
+import jakarta.persistence.criteria.*;
+import jakarta.persistence.metamodel.Attribute;
+import jakarta.persistence.metamodel.Bindable;
+import jakarta.persistence.metamodel.ManagedType;
+import jakarta.persistence.metamodel.PluralAttribute;
import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Member;
import java.util.*;
-import static javax.persistence.metamodel.Attribute.PersistentAttributeType.*;
+import static jakarta.persistence.metamodel.Attribute.PersistentAttributeType.*;
/**
diff --git a/src/test/java/th/co/geniustree/springdata/jpa/domain/Document.java b/src/test/java/th/co/geniustree/springdata/jpa/domain/Document.java
index e88cf40..ea7dab6 100644
--- a/src/test/java/th/co/geniustree/springdata/jpa/domain/Document.java
+++ b/src/test/java/th/co/geniustree/springdata/jpa/domain/Document.java
@@ -1,6 +1,6 @@
package th.co.geniustree.springdata.jpa.domain;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.io.Serializable;
import java.util.List;
import java.util.Objects;
diff --git a/src/test/java/th/co/geniustree/springdata/jpa/domain/FormType.java b/src/test/java/th/co/geniustree/springdata/jpa/domain/FormType.java
index e5b280f..b73a445 100644
--- a/src/test/java/th/co/geniustree/springdata/jpa/domain/FormType.java
+++ b/src/test/java/th/co/geniustree/springdata/jpa/domain/FormType.java
@@ -1,6 +1,6 @@
package th.co.geniustree.springdata.jpa.domain;
-import javax.persistence.*;
+import jakarta.persistence.*;
import java.io.Serializable;
/**