Validation failed for query for method public abstract java.util.List findByCompany: Spring Boot




Validation failed for query for method public abstract java.util.List findByCompany: Spring Boot





Spring Boot
2.1.8.RELEASE
The following was my Repository, I am using native query
@Repository
public interface WellRepository extends CrudRepository {

    @Query("select * From Well where company = ?1")
    List findByCompany(String company);
}

You have tell Spring to treat that query as native one. Otherwise it will try to validate it according to the JPA specification.
Need to change to the following to fix the issue
@Repository
public interface WellRepository extends CrudRepository {

    @Query(value = "select * From Well where company = ?1", nativeQuery=true)
    List findByCompany(String company);
}

No comments:

 Python Basics How to check the version of Python interpreter mac terminal

Popular in last 30 days