Cascade

Foreign Key Constraints may cause cycles or multiple cascade paths [duplicate]

大憨熊 提交于 2019-12-23 04:42:09
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Foreign key constraint may cause cycles or multiple cascade paths? I am getting the following error while creating the table listed below. Msg 1785, Level 16, State 0, Line 1 Introducing FOREIGN KEY constraint 'FKFacSupervisor' on table 'Faculty' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints. Msg 1750, Level 16, State 0,

nhibernate does not cascade delete children

时间秒杀一切 提交于 2019-12-22 05:15:14
问题 The scenario is as follows, I have 3 objects (i simplified the names) named Parent, parent's child & child's child parent's child is a set in parent, and child's child is a set in child. mapping is as follows (relevant parts) parent <set name="parentset" table="pc-table" lazy="false" fetch="subselect" cascade="all-delete-orphan" inverse="true"> <key column=FK_ID_PC" on-delete="cascade"/> <one-to-many class="parentchild,parentchild-ns"/> </set> parent's child <set name="childset" table="cc

How to find if a referenced object can be deleted?

纵然是瞬间 提交于 2019-12-22 04:07:46
问题 I have an object called "Customer" which will be used in the other tables as foreign keys. The problem is that I want to know if a "Customer" can be deleted (ie, it is not being referenced in any other tables). Is this possible with Nhibernate? 回答1: What you are asking is to find the existence of the Customer PK value in the referenced tables FK column. There are many ways you can go about this: as kgiannakakis noted, try to do the delete and if an exception is thrown rollback. Effective but

Using Ebean/JPA in my Play application, how can I delete an object in a OneToOne relationship?

旧街凉风 提交于 2019-12-21 21:56:15
问题 I have the following classes: import play.db.ebean.Model; import javax.persistence.*; @Entity public class A extends Model { @Id private int id; /* Other irrelevant properties */ @OneToOne(cascade = CascadeType.ALL, optional = true) private B b; } import play.db.ebean.Model; import javax.persistence.*; @Entity public class B extends Model { @Id private int id; /* Other irrelevant properties */ @OneToOne(mappedBy = "b") private A a; @OneToOne(cascade = CascadeType.ALL, optional = false)

SQL Server - Cascading DELETE with Recursive Foreign Keys

跟風遠走 提交于 2019-12-21 14:07:16
问题 I've spent a good amount of time trying to figure out how to implement a CASCADE ON DELETE for recursive primary keys on SQL Server for some time now. I've read about triggers, creating temporary tables, etc but have yet to find an answer that will work with my database design. Here is a Boss/Employee database example that will work for demonstration purposes: TABLE employee id|name |boss_id --|---------|------- 1 |John |1 2 |Hillary |1 3 |Hamilton |1 4 |Scott |2 5 |Susan |2 6 |Seth |2 7

Cascade delete on many-to-many between same table

你离开我真会死。 提交于 2019-12-21 10:58:51
问题 I'm trying to create a many-to-many relation between the same table in SQL Server. I have one table Object with columns ObjectId and Name . The relation follows these rules: a child can have many parents a parent can have many children ObjectA can be a child of ObjectB and ObjectB can be a child of ObjectA but an object cannot be a direct child of itself So I create a second table ObjectRelation with columns ParentId and ChildId and of course I want these relations to be deleted by cascade.

Cascade delete on many-to-many between same table

末鹿安然 提交于 2019-12-21 10:58:27
问题 I'm trying to create a many-to-many relation between the same table in SQL Server. I have one table Object with columns ObjectId and Name . The relation follows these rules: a child can have many parents a parent can have many children ObjectA can be a child of ObjectB and ObjectB can be a child of ObjectA but an object cannot be a direct child of itself So I create a second table ObjectRelation with columns ParentId and ChildId and of course I want these relations to be deleted by cascade.

How do I use the cascade option in Symfony2 Doctrine?

你离开我真会死。 提交于 2019-12-21 03:29:12
问题 I'm trying to understand the cascade option in Doctrine in Symfony2 . I would like to be able to delete a child entity (and not trigger the foreign key constraint error.) I have 3 entities: Report /** * @ORM\OneToMany(targetEntity="Response", mappedBy="report") */ protected $responses; /** * @ORM\OneToMany(targetEntity="Response", mappedBy="report") */ protected $sms; Response /** * @ORM\ManyToOne(targetEntity="Report", inversedBy="responses") */ protected $report; SMS /** * @ORM\ManyToOne

How to persist a new entity containing multiple identical instances of another unpersisted entity with spring-boot and JPA?

无人久伴 提交于 2019-12-21 02:48:05
问题 Overview: I'm building a spring-boot application which, in part, retrieves some entities from an external REST service and compares it to previous versions of the entity held locally in a database. I'm injecting EntityManager with @PersistenceContext , and using that to work with the database, as there are many entity types, and the type is initially unknown to the module. I could get a JpaRepository from a factory, but the number of different entity types is liable to grow, and I'd rather

Haar Cascades vs. LBP Cascades in Face Detection

和自甴很熟 提交于 2019-12-20 08:00:33
问题 I have been experimenting with face detection in OpenCV (Open Source Computer Vision Library), and found that one could use Haar cascades to detect faces as there are several of them provided with OpenCV. However, I have noticed that there are also several LBP cascades. After doing some research, I found that LBP stands for Local Binary Patterns, and it can also be used for face detection, according to the OpenCV Face Detection Documentation. What I would like to know is, which works better?