java.lang.IllegalArgumentException: Named parameter [ids] type mismatch; expecting [java.util.List], found [java.util.HashSet]

Spring JIRA | Gardella Juan Pablo | 4 years ago
  1. 0

    If I use {{JpaRepository}} I have the method: {code:java} /** * Returns all instances of the type with the given IDs. * * @param ids * @return */ Iterable<T> findAll(Iterable<ID> ids); {code} But if I call with a Set, the method fail. Caused by: {noformat} java.lang.IllegalArgumentException: Named parameter [ids] type mismatch; expecting [java.util.List], found [java.util.HashSet] at org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.resolveExplicitCriteriaParameterName(CriteriaQueryCompiler.java:392) at org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.setParameter(CriteriaQueryCompiler.java:380) at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:247) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:334) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:319) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.data.jpa.repository.support.LockModeRepositoryPostProcessor$LockModePopulatingMethodIntercceptor.invoke(LockModeRepositoryPostProcessor.java:91) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy62.findAll(Unknown Source) {noformat} Perhaps only fails with Hibernate, but I think at least, the Javadoc or the API must fixed.

    Spring JIRA | 4 years ago | Gardella Juan Pablo
    java.lang.IllegalArgumentException: Named parameter [ids] type mismatch; expecting [java.util.List], found [java.util.HashSet]
  2. 0

    If I use {{JpaRepository}} I have the method: {code:java} /** * Returns all instances of the type with the given IDs. * * @param ids * @return */ Iterable<T> findAll(Iterable<ID> ids); {code} But if I call with a Set, the method fail. Caused by: {noformat} java.lang.IllegalArgumentException: Named parameter [ids] type mismatch; expecting [java.util.List], found [java.util.HashSet] at org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.resolveExplicitCriteriaParameterName(CriteriaQueryCompiler.java:392) at org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.setParameter(CriteriaQueryCompiler.java:380) at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:247) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:334) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:319) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.data.jpa.repository.support.LockModeRepositoryPostProcessor$LockModePopulatingMethodIntercceptor.invoke(LockModeRepositoryPostProcessor.java:91) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) at $Proxy62.findAll(Unknown Source) {noformat} Perhaps only fails with Hibernate, but I think at least, the Javadoc or the API must fixed.

    Spring JIRA | 4 years ago | Gardella Juan Pablo
    java.lang.IllegalArgumentException: Named parameter [ids] type mismatch; expecting [java.util.List], found [java.util.HashSet]
  3. 0

    QueryDSL Spring JPA Hibernate IllegalArgumentException Parameter value not matching type

    Stack Overflow | 2 years ago | Zahanghir
    java.lang.IllegalArgumentException: Parameter value [person.username = jon] was not matching type [java.lang.String]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Getting java.lang.IllegalArgumentException: Named parameter [today] not encountered in JPA

    Stack Overflow | 2 years ago | Dave
    java.lang.IllegalArgumentException: Named parameter [today] not encountered
  6. 0

    Filters in Hibernate

    Stack Overflow | 4 years ago | AfterWorkGuinness
    java.lang.IllegalArgumentException: Incorrect type for parameter [IDS]

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Named parameter [ids] type mismatch; expecting [java.util.List], found [java.util.HashSet]

      at org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.resolveExplicitCriteriaParameterName()
    2. Hibernate EJB
      CriteriaQueryCompiler$3.setParameter
      1. org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.resolveExplicitCriteriaParameterName(CriteriaQueryCompiler.java:392)
      2. org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.setParameter(CriteriaQueryCompiler.java:380)
      2 frames
    3. Spring Data JPA
      SimpleJpaRepository.findAll
      1. org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:247)
      1 frame
    4. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    5. Spring Data Core
      RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke
      1. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:334)
      2. org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:319)
      2 frames
    6. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      1 frame
    7. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
      1 frame
    8. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      1 frame
    9. Spring Tx
      PersistenceExceptionTranslationInterceptor.invoke
      1. org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
      1 frame
    10. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      1 frame
    11. Spring Data JPA
      LockModeRepositoryPostProcessor$LockModePopulatingMethodIntercceptor.invoke
      1. org.springframework.data.jpa.repository.support.LockModeRepositoryPostProcessor$LockModePopulatingMethodIntercceptor.invoke(LockModeRepositoryPostProcessor.java:91)
      1 frame
    12. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      2. org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
      3. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      4. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
      4 frames
    13. Unknown
      $Proxy62.findAll
      1. $Proxy62.findAll(Unknown Source)
      1 frame