'Return type for the method is missing: @query from two tables
I want to return users from two tables but the following code is not working
@Query(value = "SELECT DISTINCT u.*, p.nom FROM user u INNER JOIN person p ON u.ID = p.user_id ", nativeQuery = true)
Page<User> findAllUsers(Pageable pageable);
I searched I found that I should add a for loop like in this anwser Query multi tables' columns with join in spring data jpa I tried to edit my code but the following generate an error
Page<Object[]> pages = findAllUsers(Pageable pageable);
for(Object[] obj : pages){
User user = (User) obj[0];
String nom = (String) obj[1];
}
what's wrong with this please ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
