I have the same problem, I upgraded spring boot 3.3.4 to 3.4.3. , but my mapping is different, so the solution with CascadeType.ALL don't work :
public class Parent {
private Long idParent;
@OneToMany(cascade=CascadeType.REMOVE)
@JoinColumn(name="id_parent")
private List<child> parent = new ArrayList<>();
}
public class Child {
@Column(name = "id_parent")
private Long idParent;
}
I have the same problem with :
Child child = childdDao.findById(idFromFront);
Parent parent =parentDao.findById(child.getIdParent());
...some check on parent
childDao.deleteById(idChild);
The only solution found is to do "entityManager.clear();" before delete :
Child child = childdDao.findById(idFromFront);
Parent parent =parentDao.findById(child.getIdParent());
...some check on parent
entityManager.clear();
childDao.deleteById(idChild);
???