【spring data jpa】jpa中使用in查询或删除 在@Query中怎么写 ,报错:org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'goodsConfigUid' cannot be found on null 怎么处理

示例代码如下:

@Modifying
    @Transactional
    @Query("delete from GoodsBindConfigMapping gbc " +
            "where gbc.goodsConfigUid = :#{#bean.goodsConfigUid}  " +
            "and  gbc.tenementId = :#{#bean.tenementId}  " +
            "and gbc.goodConfigFlag = :#{#bean.goodConfigFlag} "+
            "and gbc.goodTypeUid in (:#{#bean.goodsList})")
    int deleteByConfigUidAndTypeUid(@Param("bean") BindConfigBean bean);

 

报错:

org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'goodsConfigUid' cannot be found on null

 

解决方法:

是因为在使用@Query写语句的时候,没有使用@Param()标明参数实体

posted @ 2018-06-09 16:30  Angel挤一挤  阅读(1589)  评论(0)    收藏  举报