当前位置:Gxlcms > 数据库问题 > jpa语句报 org.springframework.dao.InvalidDataAccessApiUsageException: Parameter with that position [2] did not exist; nested exception is java.lang.IllegalArgumentException: Parameter with that position

jpa语句报 org.springframework.dao.InvalidDataAccessApiUsageException: Parameter with that position [2] did not exist; nested exception is java.lang.IllegalArgumentException: Parameter with that position

时间:2021-07-01 10:21:17 帮助过:4人阅读

@Query("SELECT area from Area AS area WHERE area.state=0 AND area.name like %?1% ")
Area findByIsCityAndNameLike(int iscity,String name);

第一反应: 将 AND area.name like %?1% 后的 1要改成2 但是依然报错
仔细反应了 @Query("SELECT area from Area AS area WHERE area.state=0 AND area.isCity = ?1 AND area.name like %?2% ") 就正确了

jpa语句报 org.springframework.dao.InvalidDataAccessApiUsageException: Parameter with that position [2] did not exist; nested exception is java.lang.IllegalArgumentException: Parameter with that position

标签:

人气教程排行