-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Sorry. I have generate first a stackoverflow article, but I think because it's probably a bug I will reported it here also.
https://stackoverflow.com/questions/79336531/deleteall-after-spring-boot-3-4-update-creates-transientobjectexception
We try to update our application to Spring Boot 3.4 and have with this some problems. One of it let's failed some of our integration tests. Because our application has a little complicated model I generate a small example which shows the problem.
https://github.com/rvp-c/springboot34_deletecascade
Some explaination for the model we use. We have to objects - DocumentationUnitDTO and ProcedureDTO which use a many-to-many relation. So far so easy. Problem the main object (DocumentationUnitDTO) needs an order. This we have to put into the join table (DocumentationUnitProcedureDTO).
The problems seems to be in the ProcedureDTO which have a reference to the DocumentationUnitDTO which is annotated with:
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(
name = "documentation_unit_procedure",
inverseJoinColumns = @JoinColumn(name = "documentation_unit_id"),
joinColumns = @JoinColumn(name = "procedure_id"))
The generation works fine. But the deletion seems to do a cascade from DocumentationUnitDTO -> ProcedureDTO -> DocumentationUnitDTO. (debugging of the exception)
Same code works with spring boot 3.3 without errors.
What did I try
- If I make the property
@Transient
everything works fine. - Try the same with hibernate 6.6 and it works fine