Upgrading an application that have an Entity (EntityA) with 2 required relationships with the same Entity (EntityB). And a EntityA record have both relationships to same EntityB record, that EntityA record cannot be removed.
Deleting it causes:
org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.TransientObjectException: persistent instance references an unsaved transient instance of 'tech.jhipster.sample.domain.JpaFilteringRelationshipEntity' (save the transient instance before flushing)
at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:368)
at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:246)
at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:566)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:795)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:758)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:698)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:416)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:727)
at tech.jhipster.sample.service.JpaFilteringRelationshipService$$SpringCGLIB$$0.delete(<generated>)
Workarounds:
downgrade from hibernate 6.6.x to hibernate 6.5.x.
Upgrading an application that have an Entity (EntityA) with 2 required relationships with the same Entity (EntityB). And a EntityA record have both relationships to same EntityB record, that EntityA record cannot be removed.
Deleting it causes:
Workarounds: