[英]What's the difference between @CascadeOnDelete and CascadeType.REMOVE annotations?
At first I've expected that with CascadeType.REMOVE
I'll be able to delete foreign keys in my table , but I sill got an exception. 起初,我期望使用
CascadeType.REMOVE
能够删除表中的外键,但是我仍然遇到了异常。 But with @CascadeOnDelete
it's ok .What's the difference between the two annotations? 但是使用
@CascadeOnDelete
可以,两个注释之间有什么区别?
EDIT: I've saw the DataNucleus' comment.Cascade on delete comes from org.eclipse.persistence.annotations.CascadeOnDelete
.Which raises the question how good idea is to be used. 编辑:我已经看到了DataNucleus的comment.cascade上的删除来自
org.eclipse.persistence.annotations.CascadeOnDelete
。这引发了一个问题,即如何使用好主意。
当您使用CascadeType.Remove时,级联将由ORM工具处理,但是当您希望由数据库处理级联时,可以使用@CascadeOnDelete。但是,当您使用@CascadeOnDelete时,请确保您使用的数据库是使用应支持级联。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.