diff --git a/pom.xml b/pom.xml
index febef7ea8..9954d5ce0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,6 @@
1.8.0.10
2.0.0
2.4.0
- 3.6.3
1.12.0.BUILD-SNAPSHOT
reuseReports
@@ -223,14 +222,14 @@
- com.mysema.querydsl
+ com.querydsl
querydsl-apt
${querydsl}
provided
- com.mysema.querydsl
+ com.querydsl
querydsl-jpa
${querydsl}
true
@@ -424,7 +423,7 @@
true
- com.mysema.query.apt.jpa.JPAAnnotationProcessor
+ com.querydsl.apt.jpa.JPAAnnotationProcessor
org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor
diff --git a/src/main/java/org/springframework/data/jpa/repository/support/QueryDslJpaRepository.java b/src/main/java/org/springframework/data/jpa/repository/support/QueryDslJpaRepository.java
index 05613f689..c7cc18d79 100644
--- a/src/main/java/org/springframework/data/jpa/repository/support/QueryDslJpaRepository.java
+++ b/src/main/java/org/springframework/data/jpa/repository/support/QueryDslJpaRepository.java
@@ -32,12 +32,12 @@ import org.springframework.data.querydsl.QSort;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.querydsl.SimpleEntityPathResolver;
-import com.mysema.query.jpa.JPQLQuery;
-import com.mysema.query.jpa.impl.JPAQuery;
-import com.mysema.query.types.EntityPath;
-import com.mysema.query.types.OrderSpecifier;
-import com.mysema.query.types.Predicate;
-import com.mysema.query.types.path.PathBuilder;
+import com.querydsl.core.types.EntityPath;
+import com.querydsl.core.types.OrderSpecifier;
+import com.querydsl.core.types.Predicate;
+import com.querydsl.core.types.dsl.PathBuilder;
+import com.querydsl.jpa.JPQLQuery;
+import com.querydsl.jpa.impl.AbstractJPAQuery;
/**
* QueryDsl specific extension of {@link SimpleJpaRepository} which adds implementation for
@@ -46,8 +46,8 @@ import com.mysema.query.types.path.PathBuilder;
* @author Oliver Gierke
* @author Thomas Darimont
*/
-public class QueryDslJpaRepository extends SimpleJpaRepository implements
- QueryDslPredicateExecutor {
+public class QueryDslJpaRepository extends SimpleJpaRepository
+ implements QueryDslPredicateExecutor {
private static final EntityPathResolver DEFAULT_ENTITY_PATH_RESOLVER = SimpleEntityPathResolver.INSTANCE;
@@ -78,6 +78,7 @@ public class QueryDslJpaRepository extends SimpleJpa
EntityPathResolver resolver) {
super(entityInformation, entityManager);
+
this.path = resolver.createPath(entityInformation.getJavaType());
this.builder = new PathBuilder(path.getType(), path.getMetadata());
this.querydsl = new Querydsl(entityManager, builder);
@@ -89,7 +90,7 @@ public class QueryDslJpaRepository extends SimpleJpa
*/
@Override
public T findOne(Predicate predicate) {
- return createQuery(predicate).uniqueResult(path);
+ return createQuery(predicate).select(path).fetchOne();
}
/*
@@ -98,7 +99,7 @@ public class QueryDslJpaRepository extends SimpleJpa
*/
@Override
public List findAll(Predicate predicate) {
- return createQuery(predicate).list(path);
+ return createQuery(predicate).select(path).fetch();
}
/*
@@ -107,7 +108,7 @@ public class QueryDslJpaRepository extends SimpleJpa
*/
@Override
public List findAll(Predicate predicate, OrderSpecifier>... orders) {
- return executeSorted(createQuery(predicate), orders);
+ return executeSorted(createQuery(predicate).select(path), orders);
}
/*
@@ -116,7 +117,7 @@ public class QueryDslJpaRepository extends SimpleJpa
*/
@Override
public List findAll(Predicate predicate, Sort sort) {
- return executeSorted(createQuery(predicate), sort);
+ return executeSorted(createQuery(predicate).select(path), sort);
}
/*
@@ -125,7 +126,7 @@ public class QueryDslJpaRepository extends SimpleJpa
*/
@Override
public List findAll(OrderSpecifier>... orders) {
- return executeSorted(createQuery(new Predicate[0]), orders);
+ return executeSorted(createQuery(new Predicate[0]).select(path), orders);
}
/*
@@ -135,11 +136,11 @@ public class QueryDslJpaRepository extends SimpleJpa
@Override
public Page findAll(Predicate predicate, Pageable pageable) {
- JPQLQuery countQuery = createQuery(predicate);
- JPQLQuery query = querydsl.applyPagination(pageable, createQuery(predicate));
+ JPQLQuery> countQuery = createQuery(predicate);
+ JPQLQuery query = querydsl.applyPagination(pageable, createQuery(predicate).select(path));
- Long total = countQuery.count();
- List content = pageable == null || total > pageable.getOffset() ? query.list(path) : Collections. emptyList();
+ long total = countQuery.fetchCount();
+ List content = pageable == null || total > pageable.getOffset() ? query.fetch() : Collections. emptyList();
return new PageImpl(content, pageable, total);
}
@@ -150,7 +151,7 @@ public class QueryDslJpaRepository extends SimpleJpa
*/
@Override
public long count(Predicate predicate) {
- return createQuery(predicate).count();
+ return createQuery(predicate).fetchCount();
}
/*
@@ -159,7 +160,7 @@ public class QueryDslJpaRepository extends SimpleJpa
*/
@Override
public boolean exists(Predicate predicate) {
- return createQuery(predicate).exists();
+ return createQuery(predicate).fetchCount() > 0;
}
/**
@@ -168,9 +169,9 @@ public class QueryDslJpaRepository extends SimpleJpa
* @param predicate
* @return the Querydsl {@link JPQLQuery}.
*/
- protected JPQLQuery createQuery(Predicate... predicate) {
+ protected JPQLQuery> createQuery(Predicate... predicate) {
- JPAQuery query = querydsl.createQuery(path).where(predicate);
+ AbstractJPAQuery, ?> query = querydsl.createQuery(path).where(predicate);
CrudMethodMetadata metadata = getRepositoryMethodMetadata();
if (metadata == null) {
@@ -194,7 +195,7 @@ public class QueryDslJpaRepository extends SimpleJpa
* @param orders must not be {@literal null}.
* @return
*/
- private List executeSorted(JPQLQuery query, OrderSpecifier>... orders) {
+ private List executeSorted(JPQLQuery query, OrderSpecifier>... orders) {
return executeSorted(query, new QSort(orders));
}
@@ -205,7 +206,7 @@ public class QueryDslJpaRepository extends SimpleJpa
* @param sort must not be {@literal null}.
* @return
*/
- private List executeSorted(JPQLQuery query, Sort sort) {
- return querydsl.applySorting(sort, query).list(path);
+ private List executeSorted(JPQLQuery query, Sort sort) {
+ return querydsl.applySorting(sort, query).fetch();
}
}
diff --git a/src/main/java/org/springframework/data/jpa/repository/support/QueryDslRepositorySupport.java b/src/main/java/org/springframework/data/jpa/repository/support/QueryDslRepositorySupport.java
index 878bac417..22a4fef89 100644
--- a/src/main/java/org/springframework/data/jpa/repository/support/QueryDslRepositorySupport.java
+++ b/src/main/java/org/springframework/data/jpa/repository/support/QueryDslRepositorySupport.java
@@ -22,14 +22,14 @@ import javax.persistence.PersistenceContext;
import org.springframework.stereotype.Repository;
import org.springframework.util.Assert;
-import com.mysema.query.dml.DeleteClause;
-import com.mysema.query.dml.UpdateClause;
-import com.mysema.query.jpa.JPQLQuery;
-import com.mysema.query.jpa.impl.JPADeleteClause;
-import com.mysema.query.jpa.impl.JPAUpdateClause;
-import com.mysema.query.types.EntityPath;
-import com.mysema.query.types.path.PathBuilder;
-import com.mysema.query.types.path.PathBuilderFactory;
+import com.querydsl.core.dml.DeleteClause;
+import com.querydsl.core.dml.UpdateClause;
+import com.querydsl.core.types.EntityPath;
+import com.querydsl.core.types.dsl.PathBuilder;
+import com.querydsl.core.types.dsl.PathBuilderFactory;
+import com.querydsl.jpa.JPQLQuery;
+import com.querydsl.jpa.impl.JPADeleteClause;
+import com.querydsl.jpa.impl.JPAUpdateClause;
/**
* Base class for implementing repositories using QueryDsl library.
@@ -88,12 +88,23 @@ public abstract class QueryDslRepositorySupport {
/**
* Returns a fresh {@link JPQLQuery}.
*
+ * @param path must not be {@literal null}.
* @return the Querydsl {@link JPQLQuery}.
*/
- protected JPQLQuery from(EntityPath>... paths) {
+ protected JPQLQuery