我在REST中使用
spring数据.我有一个表国家和一个名为Country.
java的实体
我在CountryRepositopry中注释了我的方法
public interface CountryRepository extends Repository {
@RestResource(path = "bycode3")
@Query("select c from Country c where c.codeAlpha3=?1 and c.active=1")
Country findCountryByCodeAlpha3(@Param("code") String countryCode);
}
我在启动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'!