-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed as not planned
Closed as not planned
Copy link
Labels
for: external-projectFor an external project and not something we can fixFor an external project and not something we can fix
Description
Hi,
Overview
We met an unexpected error upgrading to spring-boot 3.4.0
I'm not sure this bug deals with spring-data, but i have not been able to reproduce the default using hibernate directly ; maybe you may provide new directions of investigations...
Here is a sample project representing the default with the minimal configuration needed to reproduce it : https://github.com/tcordel/jpa-named-query/tree/main
org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.TransientObjectException: persistent instance references an unsaved transient instance of 'com.example.demo.entities.UserNotifEntity' (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)
Details
This issue appears only if the optional fetch is done here : NotificationService
Entities
classDiagram
class ApplicationEntity {
}
class UserEntity {
}
class TypeNotificationEntity{
}
class UserNotifEntity {
+UserEntity User
+TypeNotificationEntity typeNotif
}
class UserNotifAppliEntity {
+UserNotifEntity UserNotif
+ApplicationEntity application
}
Tests
List of the tests present in DemoApplicationTests :
- buggyWithTransactionalUsingNamedQueryForDeletion : This test presents the bug
- workingWithoutTransactional : condition of bug but removing @transactional annotation on service makes it pass
- workingRequiringNewTransactionForDeletion : condition of bug but requiring new transaction before calling named query makes it pass
- workingInSameConditionWithJpqlForDeletion : condition of bug but using jpql for deletion makes it pass
- workingInSameConditionWithCriteriaForDeletion: consition of bug but using criteria for deletion make it pass
Thanks for your time :)
Metadata
Metadata
Assignees
Labels
for: external-projectFor an external project and not something we can fixFor an external project and not something we can fix