JPA: Cascade remove does not delete child

后端 未结 3 509
温柔的废话
温柔的废话 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 19:04

    Don't map your relation table as en entity. Use @ManyToMany Instead and make your user entity owner of the relationship.

    Edit :

    So your association table primary key must be composed of both foreign key.

    See this http://giannigar.wordpress.com/2009/09/04/mapping-a-many-to-many-join-table-with-extra-column-using-jpa/

提交回复
热议问题