JPA not generating “on delete set null” FK restrictions

前端 未结 5 586
[愿得一人]
[愿得一人] 2021-01-04 19:11

I have two related clases JPA-annotated. Alarm and Status. One Alarm can have one Status.

What I need is to be able to delete one Status and \"propagate\" a null v

5条回答
  •  离开以前
    2021-01-04 19:43

    OpenJPA has

    @ForeignKey(deleteAction=ForeignKeyAction.NULL)
    

    but there is no standard JPA way to do this (and apparently it is impossible with Hibernate).

    Makes me want to go back to JDO.

提交回复
热议问题