Not found in annotated query error with @Query
I am using spring data with REST. I have a table and a corresponding entity called Country.java
I have annotated my method in CountryRepositopry as
public interface CountryRepository extends Repository<Country, Short> {
@RestResource(path = "bycode3")
@Query("select c from Country c where c.codeAlpha3=?1 and c.active=1")
Country findCountryByCodeAlpha3(@Param("code") String countryCode);
}
I am getting the following exception when starting tomcat -
Caused by: java.lang.IllegalStateException: Using named parameters for method public abstract com.persistence.entity.common.Country com.persistence.repository.CountryRepository.findCountryByCodeAlpha3(java.lang.String) but parameter 'code' not found in annotated query 'select c from Country c where c.codeAlpha3=?1 and c.active=1'!
+3
source to share