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:

 My Attempt to learn AI  GPT Generative Pretrained Transformer Created by Google in 2017 with the publication of the paper "Attention ...

Popular in last 30 days