Skip to content

Verify that interface-based projections work with subselects #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>2.3.0.BUILD-SNAPSHOT</version>
<version>2.3.0.DATAJPA-1713-SNAPSHOT</version>

<name>Spring Data JPA</name>
<description>Spring Data module for JPA repositories.</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,17 @@ public void rejectsStreamExecutionIfNoSurroundingTransactionActive() {
public void executesNamedQueryWithConstructorExpression() {
userRepository.findByNamedQueryWithConstructorExpression();
}

@Test // DATAJPA-1713
public void selectProjectionWithSubselect() {

List<UserRepository.NameOnly> list = userRepository.findProjectionBySubselect();
assertThat(list).isNotEmpty() //
.allSatisfy(no -> {

assertThat(no.getFirstname()).describedAs("firstname").isNotNull();
assertThat(no.getLastname()).describedAs("lastname").isNotNull();
});

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,10 @@ Page<User> findAllOrderedBySpecialNameMultipleParams(@Param("name") String name,
// DATAJPA-1303
Page<User> findByAttributesIgnoreCaseIn(Pageable pageable, String... attributes);

// DATAJPA-1713
@Query("select u from User u where firstname >= (select Min(u0.firstname) from User u0 )")
List<NameOnly> findProjectionBySubselect();

interface RolesAndFirstname {

String getFirstname();
Expand Down