public interface UserRepository extends JpaRepository<User, Long> { @Query(value = "SELECT * FROM USERS WHERE EMAIL_ADDRESS = ?0", nativeQuery = true) User findByEmailAddress(String emailAddress); }
Let's say I have the code above where I select * from the user. What if I do not want this method to return a User object. Is there a way to manually map data to a custom MyUser object? Can I do all this in the UserRepository interface?
Thanks!
source share