diff --git a/pom.xml b/pom.xml index b9faee5398..edafbe0a08 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-jpa - 2.3.0.BUILD-SNAPSHOT + 2.3.0.DATAJPA-1713-SNAPSHOT Spring Data JPA Spring Data module for JPA repositories. diff --git a/src/test/java/org/springframework/data/jpa/repository/UserRepositoryFinderTests.java b/src/test/java/org/springframework/data/jpa/repository/UserRepositoryFinderTests.java index f0fe0e1d90..8389434beb 100644 --- a/src/test/java/org/springframework/data/jpa/repository/UserRepositoryFinderTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/UserRepositoryFinderTests.java @@ -281,4 +281,17 @@ public void rejectsStreamExecutionIfNoSurroundingTransactionActive() { public void executesNamedQueryWithConstructorExpression() { userRepository.findByNamedQueryWithConstructorExpression(); } + + @Test // DATAJPA-1713 + public void selectProjectionWithSubselect() { + + List list = userRepository.findProjectionBySubselect(); + assertThat(list).isNotEmpty() // + .allSatisfy(no -> { + + assertThat(no.getFirstname()).describedAs("firstname").isNotNull(); + assertThat(no.getLastname()).describedAs("lastname").isNotNull(); + }); + + } } diff --git a/src/test/java/org/springframework/data/jpa/repository/sample/UserRepository.java b/src/test/java/org/springframework/data/jpa/repository/sample/UserRepository.java index 076235e282..ccf9bd8a90 100644 --- a/src/test/java/org/springframework/data/jpa/repository/sample/UserRepository.java +++ b/src/test/java/org/springframework/data/jpa/repository/sample/UserRepository.java @@ -612,6 +612,10 @@ Page findAllOrderedBySpecialNameMultipleParams(@Param("name") String name, // DATAJPA-1303 Page findByAttributesIgnoreCaseIn(Pageable pageable, String... attributes); + // DATAJPA-1713 + @Query("select u from User u where firstname >= (select Min(u0.firstname) from User u0 )") + List findProjectionBySubselect(); + interface RolesAndFirstname { String getFirstname();