Question: When using Spring Data Jpa as the persistence layer, the following error occurs when using @Query annotation:
Validation failed for query for method public abstract
Solution: This is because the nativeQuery attribute value is not explicitly set to true when using native SQL in the @Query annotation.
@Query(nativeQuery = true,value = "select * from user where id = ?")
List<User> getById(@Param("id") Integer id);