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 401465df4..c1a59fb7a 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 @@ -196,7 +196,7 @@ public class QueryDslJpaRepository extends SimpleJpa /** * Creates a new {@link JPQLQuery} count query for the given {@link Predicate}. * - * @param predicate + * @param predicate, can be {@literal null}. * @return the Querydsl count {@link JPQLQuery}. */ protected JPQLQuery createCountQuery(Predicate predicate) { diff --git a/src/test/java/org/springframework/data/jpa/repository/EntityGraphRepositoryMethodsIntegrationTests.java b/src/test/java/org/springframework/data/jpa/repository/EntityGraphRepositoryMethodsIntegrationTests.java index 03bccfb6c..c23f16c80 100644 --- a/src/test/java/org/springframework/data/jpa/repository/EntityGraphRepositoryMethodsIntegrationTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/EntityGraphRepositoryMethodsIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2015 the original author or authors. + * Copyright 2014-2016 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. @@ -44,6 +44,7 @@ import org.springframework.transaction.annotation.Transactional; * * @author Thomas Darimont * @author Oliver Gierke + * @author Jocelyn Ntakpe */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:config/namespace-autoconfig-context.xml") @@ -137,12 +138,14 @@ public class EntityGraphRepositoryMethodsIntegrationTests { */ @Test public void shouldRespectConfiguredJpaEntityGraphWithPaginationAndQueryDslPredicates() { + Assume.assumeTrue(currentEntityManagerIsAJpa21EntityManager(em)); + Page page = repository.findAll(QUser.user.firstname.isNotNull(), new PageRequest(0, 100)); List result = page.getContent(); + assertThat(result.size(), is(2)); assertThat(Persistence.getPersistenceUtil().isLoaded(result.get(0).getRoles()), is(true)); assertThat(result.get(0), is(tom)); } - } diff --git a/src/test/java/org/springframework/data/jpa/repository/sample/RepositoryMethodsWithEntityGraphConfigRepository.java b/src/test/java/org/springframework/data/jpa/repository/sample/RepositoryMethodsWithEntityGraphConfigRepository.java index 23f2350ec..0d17a8c2b 100644 --- a/src/test/java/org/springframework/data/jpa/repository/sample/RepositoryMethodsWithEntityGraphConfigRepository.java +++ b/src/test/java/org/springframework/data/jpa/repository/sample/RepositoryMethodsWithEntityGraphConfigRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2015 the original author or authors. + * Copyright 2014-2016 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. @@ -17,7 +17,6 @@ package org.springframework.data.jpa.repository.sample; import java.util.List; -import com.querydsl.core.types.Predicate; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.domain.sample.User; @@ -26,6 +25,8 @@ import org.springframework.data.jpa.repository.EntityGraph.EntityGraphType; import org.springframework.data.querydsl.QueryDslPredicateExecutor; import org.springframework.data.repository.CrudRepository; +import com.querydsl.core.types.Predicate; + /** * Custom repository interface that customizes the fetching behavior of querys of well known repository interface * methods via {@link EntityGraph} annotation. @@ -33,7 +34,8 @@ import org.springframework.data.repository.CrudRepository; * @author Thomas Darimont * @author Jocelyn Ntakpe */ -public interface RepositoryMethodsWithEntityGraphConfigRepository extends CrudRepository, QueryDslPredicateExecutor { +public interface RepositoryMethodsWithEntityGraphConfigRepository + extends CrudRepository, QueryDslPredicateExecutor { /** * Should find all users. @@ -52,7 +54,7 @@ public interface RepositoryMethodsWithEntityGraphConfigRepository extends CrudRe */ @EntityGraph User getOneWithDefinedEntityGraphById(Integer id); - + /** * @see DATAJPA-696 */ @@ -62,6 +64,6 @@ public interface RepositoryMethodsWithEntityGraphConfigRepository extends CrudRe /** * @see DATAJPA-790 */ - @EntityGraph(type = EntityGraphType.FETCH, value = "User.detail") + @EntityGraph("User.detail") Page findAll(Predicate predicate, Pageable pageable); }