简体   繁体   English

@CascadeOnDelete和CascadeType.REMOVE批注有什么区别?

[英]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.

相关问题 JPA 中的 CascadeType.REMOVE 和 orphanRemoval 有什么区别? - What is the difference between CascadeType.REMOVE and orphanRemoval in JPA? JPA CascadeType.REMOVE不会删除reshipsship的子级 - JPA CascadeType.REMOVE not deleting children of a relashionship 没有 CascadeType.REMOVE 的 CascadeType.ALL 更改持久化行为 - CascadeType.ALL without CascadeType.REMOVE changes persist behavior @ManyToMany with cascade = CascadeType.REMOVE删除关联和实体 - @ManyToMany with cascade = CascadeType.REMOVE removes associations AND entities Hibernate:无法删除对象 - 外键约束 - CascadeType.REMOVE - Hibernate: Cannot Delete Object - foreign key constraint - CascadeType.REMOVE 具有仅CascadeType.REMOVE的双向@OneToOne保存更改:不需要 - Bi-directional @OneToOne with ONLY CascadeType.REMOVE saves changes: that is not wanted Hibernate在ManyToMany关系中生成其他查询,而没有设置CascadeType.REMOVE - Hibernate generate additional query in ManyToMany relation while no CascadeType.REMOVE is set 如何处理@Component和@Repository / @Service注释之间的区别是什么? - What's the difference between how @Component and @Repository / @Service annotations are processed? Spring 中的@Component、@Repository 和@Service 注解有什么区别? - What's the difference between @Component, @Repository & @Service annotations in Spring? Play控制器的@After和@Finally注释之间有什么区别? - What's the difference between @After and @Finally annotations for Play controllers
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM