Closed as duplicate of#3784
Description
I think this is a very basic query that shouldn't have any behavior changes:
@Query(
"""
SELECT DISTINCT u
FROM UserBE u
JOIN u.tenantRoles tr
WHERE tr.tenantId = :tenantId
AND (:usernameFilter IS NULL or u.username LIKE :usernameFilter)
""")
Page<UserBE> findByTenantId(
@Param("tenantId") long tenantId,
@Param("usernameFilter") @Nullable String usernameFilter,
Pageable pageable);
After the upgrade, I get this error when running it:
Caused by: org.springframework.dao.InvalidDataAccessResourceUsageException: No argument for named parameter ':usernameFilter_1'
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:298)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:241)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:560)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:343)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:160)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:136)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:223)
Is there a starter project I could clone to provide a failing test case? The hibernate project does this and it makes reporting issues very simple.