79592239

Date: 2025-04-25 09:44:58
Score: 6.5 🚩
Natty: 5.5
Report link

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);

???

Reasons:
  • Blacklisted phrase (1): I have the same problem
  • Blacklisted phrase (1): ???
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Me too answer (2.5): I have the same problem
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: Simon