不一致的IllegalArgumentException

时间:2017-11-09 15:52:38

标签: java spring hibernate spring-data-jpa jpql

我有一个类似的查询:

@Query("select I from Indicator I where I.bankId in (:bankIds) ")
public List<Indicator> getIndicatorDetailsByBankIdList(@Param("bankIds") Set<Long> bankIdList);

大部分时间 正常 。有时它会抛出以下异常。

Description - Parameter with that name [bankIds] did not exist; nested exception is java.lang.IllegalArgumentException: Parameter with that name [bankIds] did not exist, StackTrace - java.lang.IllegalArgumentException: Parameter with that name [bankIds] did not exist
    at org.hibernate.jpa.spi.BaseQueryImpl.findParameterRegistration(BaseQueryImpl.java:505)
    at org.hibernate.jpa.spi.BaseQueryImpl.setParameter(BaseQueryImpl.java:631)
    at org.hibernate.jpa.spi.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:180)
    at org.hibernate.jpa.spi.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:49)

观察

  1. 我不确定我是否正确地添加了这个观察结果,但我猜这个服务只有在数据较重的模块中使用时才会失败(即使在这里它有时也会失败)。内存问题会导致抛出这些异常吗?

  2. 在同一实体的另一种方法中观察到了相关问题:

  3. @Query("select I from Indicator I where I.activityId in (:activityIds) ")
        	public List<Indicator> getIndicatorDetailsByActivityIdList(@Param("activityIds") Set<Long> acyIdList);

0 个答案:

没有答案