Skip to content

**DO NOT MERGE** DATAJPA-1714 DTOs don't work with native queries. #419

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-1714-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,9 @@ public void rejectsStreamExecutionIfNoSurroundingTransactionActive() {
public void executesNamedQueryWithConstructorExpression() {
userRepository.findByNamedQueryWithConstructorExpression();
}

@Test // DATAJPA-1714
public void returnsDtoForNativeQuery() {
userRepository.findDtoByNativeQuery();
}
}
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-1714
@Query(value = "select firstname, lastname from SD_User", nativeQuery = true)
List<NameOnlyDto> findDtoByNativeQuery();

interface RolesAndFirstname {

String getFirstname();
Expand Down