Skip to content

Commit c98d1d7

Browse files
committed
Entity Via SqlResultSetMapping And NamedNativeQuery
1 parent 0e6a2e6 commit c98d1d7

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

HibernateSpringBootDtoSqlResultSetMappingAndNamedNativeQueryEntity2/src/main/java/com/bookstore/MainApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public ApplicationRunner init() {
3131

3232
System.out.println("==========================================");
3333

34-
List<Object[]> authorsArray = bookstoreService.fetchAuthorWithBook();
35-
authorsArray.forEach(a -> System.out.println(Arrays.toString(a)));
34+
// List<Object[]> authorsArray = bookstoreService.fetchAuthorWithBook();
35+
// authorsArray.forEach(a -> System.out.println(Arrays.toString(a)));
3636
};
3737
}
3838
}

HibernateSpringBootDtoSqlResultSetMappingAndNamedNativeQueryEntity2/src/main/java/com/bookstore/repository/AuthorRepository.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public interface AuthorRepository extends JpaRepository<Author, Long> {
1414
@Query(nativeQuery = true)
1515
List<Author> fetchAll();
1616

17-
@Query(nativeQuery = true)
18-
List<Object[]> fetchWithBook();
17+
/* this is not supported yet */
18+
// @Query(nativeQuery = true)
19+
// List<Object[]> fetchWithBook();
1920
}

HibernateSpringBootDtoSqlResultSetMappingAndNamedNativeQueryEntity2/src/main/java/com/bookstore/service/BookstoreService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ public List<Author> fetchAuthors() {
1919
return authorRepository.fetchAll();
2020
}
2121

22+
/*
2223
public List<Object[]> fetchAuthorWithBook() {
2324
2425
return authorRepository.fetchWithBook();
2526
}
27+
*/
2628
}

0 commit comments

Comments
 (0)