JPA: Cascade remove does not delete child

后端 未结 3 567
温柔的废话
温柔的废话 2021-01-19 18:09

Edit: Modifying the question to better reflect the problem. Originally posted question here

I have a parent (Context) and a child (User) en

3条回答
  •  我在风中等你
    2021-01-19 18:58

    You are calling remove() on sampleUser not sampleContext, and User does not cascade remove to Context, so you should only see the User being deleted.

    If you call remove() on sampleContext, you must also ensure that when you created the User you added the User to the Context's users. You are most likely only setting the User's conext.

提交回复
热议问题