Uploaded image for project: 'Spring Data JPA'
  1. Spring Data JPA
  2. DATAJPA-232

Parameter binding in SimpleJpaRepository.findAll(Iterable<ID> ids) fails for non-Lists

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1 GA
    • Fix Version/s: 1.1.1, 1.2 M1
    • Component/s: Core
    • Labels:
      None
    • Environment:
      All

      Description

      If I use JpaRepository I have the method:

      /**
       * Returns all instances of the type with the given IDs.
       * 
       * @param ids
       * @return
       */
      Iterable<T> findAll(Iterable<ID> ids);
      

      But if I call with a Set, the method fail.

      Caused by:

      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)
      

      Perhaps only fails with Hibernate, but I think at least, the Javadoc or the API must fixed.

        Attachments

          Activity

            People

            • Assignee:
              olivergierke Oliver Drotbohm
              Reporter:
              gardellajuanpablo Gardella Juan Pablo
              Last updater:
              Trevor Marshall
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: