-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
type: regressionA regression from a previous releaseA regression from a previous release
Milestone
Description
I've found out that with the new spring-data-jpa major update (4.x) findByInXXX repository methods don't work with EclipseLink JPA vendor (they used to work with 3.5.9).
They throw:
org.springframework.dao.InvalidDataAccessApiUsageException: You have attempted to set a value of type class java.util.ImmutableCollections$List12 for parameter 1 with expected type of class java.lang.String from query string SELECT ...
Exception in thread "main" org.springframework.dao.InvalidDataAccessApiUsageException: You have attempted to set a value of type class java.util.ImmutableCollections$List12 for parameter 1 with expected type of class java.lang.String from query string SELECT u FROM User u WHERE u.name IN (?1).
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:365)
at org.springframework.orm.jpa.DefaultJpaDialect.translateExceptionIfPossible(DefaultJpaDialect.java:127)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:556)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:346)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:157)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:137)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:222)
at jdk.proxy2/jdk.proxy2.$Proxy70.findByNameIn(Unknown Source)
at com.am2.reproducer.findByInXXX.ReproducerApplication.test(ReproducerApplication.java:34)
at com.am2.reproducer.findByInXXX.ReproducerApplication.main(ReproducerApplication.java:30)
Caused by: java.lang.IllegalArgumentException: You have attempted to set a value of type class java.util.ImmutableCollections$List12 for parameter 1 with expected type of class java.lang.String from query string SELECT u FROM User u WHERE u.name IN (?1).
at org.eclipse.persistence.internal.jpa.QueryImpl.setParameterInternal(QueryImpl.java:941)
at org.eclipse.persistence.internal.jpa.QueryImpl.setParameterInternal(QueryImpl.java:915)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setParameter(EJBQueryImpl.java:465)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setParameter(EJBQueryImpl.java:69)
at org.springframework.data.jpa.repository.query.QueryParameterSetter$BindableQuery.setParameter(QueryParameterSetter.java:311)
at org.springframework.data.jpa.repository.query.QueryParameterSetter$NamedOrIndexedQueryParameterSetter.setParameter(QueryParameterSetter.java:117)
at org.springframework.data.jpa.repository.query.QueryParameterSetter$NamedOrIndexedQueryParameterSetter.setParameter(QueryParameterSetter.java:95)
at org.springframework.data.jpa.repository.query.ParameterBinder.bind(ParameterBinder.java:87)
at org.springframework.data.jpa.repository.query.ParameterBinder.bind(ParameterBinder.java:79)
at org.springframework.data.jpa.repository.query.ParameterBinder.bindAndPrepare(ParameterBinder.java:100)
at org.springframework.data.jpa.repository.query.PartTreeJpaQuery$QueryPreparer.invokeBinding(PartTreeJpaQuery.java:368)
at org.springframework.data.jpa.repository.query.PartTreeJpaQuery$QueryPreparer.createQuery(PartTreeJpaQuery.java:250)
at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.doCreateQuery(PartTreeJpaQuery.java:125)
at org.springframework.data.jpa.repository.query.AbstractJpaQuery.createQuery(AbstractJpaQuery.java:264)
at org.springframework.data.jpa.repository.query.JpaQueryExecution$CollectionExecution.doExecute(JpaQueryExecution.java:132)
at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:99)
at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:164)
at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:154)
at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:169)
at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:158)
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:167)
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:146)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:370)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:118)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:135)
... 7 moreSince they used to work with previous spring-data-jpa major version (3.x), I'm posting it as a bug here. If it is an issue in EclipseLink which just pops up now it could be moved to EclipseLink issue tracker.
I'm attacing springboot-eclipselink-findByInXXX.zip which is a minimal reproducer of the issue. It is a simple spring boot application with an application class ReproducerApplication and a repository UserRepository with findByInXXX method. It demonstrates:
- (default) with spring-data-jpa 4.0.1 and eclipselink 4.0.9 (or with 5.0.0-B12) -
findByInXXXfail - with spring-data-jpa 3.5.9 and eclipselink 4.0.9 -
findByInXXXwork (to start in that mode: commentspring-boot.version4.0.1 and uncommentspring-boot.version3.5.9 in pom.xml, commentSpring 4.x specific importsand uncommentSpring 3.x specific importsin the ReproducerApplication.java)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type: regressionA regression from a previous releaseA regression from a previous release