-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed as duplicate of#4015
Labels
status: duplicateA duplicate of another issueA duplicate of another issue
Description
I just updated my spring-boot app from 3.5.5 -> 3.5.6, which updated spring-data-jpa from 3.5.3 -> 3.5.4.
Both of these examples work when I revert spring-boot to 3.5.5.
I have a repository method:
int deleteByFreightRateGroupId(long freightRateGroupId);
Deleting loads all entities being deleted and then throws:
When I attempt to use this method, it appears to load every entity that is being deleted, and then internally throws an error because it has loaded all those entities. I think the previous behavior would just load the count of the deleted entities returned from the DB.
org.springframework.dao.IncorrectResultSizeDataAccessException: Delete query returned more than one element: expected 1, actual 8808
at org.springframework.data.jpa.repository.query.JpaQueryExecution$DeleteExecution.doExecute(JpaQueryExecution.java:307)
at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:95)
at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:160)
at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:148)
at org.springframework.data.repository.core.support.RepositoryMethodInvoker.doInvoke(RepositoryMethodInvoker.java:170)
at org.springframework.data.repository.core.support.RepositoryMethodInvoker.invoke(RepositoryMethodInvoker.java:158)
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.doInvoke(QueryExecutorMethodInterceptor.java:170)
at org.springframework.data.repository.core.support.QueryExecutorMethodInterceptor.invoke(QueryExecutorMethodInterceptor.java:149)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:380)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:138)
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)
at jdk.proxy3/jdk.proxy3.$Proxy325.deleteByFreightRateGroupId(Unknown Source)
at com.project.backends.lumber.FreightRateBackend.deleteAllRatesInGroup(FreightRateBackend.java:101)
Deleting no rows results in NPE
org.springframework.aop.AopInvocationException: Null return value from advice does not match primitive return type for: public abstract int com.project.repositories.lumber.FreightRateRepository.deleteByFreightRateGroupId(long)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:237)
at jdk.proxy3/jdk.proxy3.$Proxy325.deleteByFreightRateGroupId(Unknown Source)
at com.project.backends.lumber.FreightRateBackend.deleteAllRatesInGroup(FreightRateBackend.java:101)
Metadata
Metadata
Assignees
Labels
status: duplicateA duplicate of another issueA duplicate of another issue