Questions tagged [cascading-deletes]

The concept of SQL databases deleting rows that refer (via a foreign key) to a deleted row.

The concept of SQL databases deleting rows that refer (via a foreign key) to a deleted row. The deletion is performed recursively and enabled with the ON DELETE CASCADE property of the foreign key.

587 questions
0
votes
1 answer

EF 6, How to delete an Entity without enforcing cascade delete and satisfying Foreign Key restraints

I'm trying to figure out how to delete an entity without cascade delete I'm assuming if i do this right, when i delete a related entity (Country, see below), it will set the Country FK in Client to null and the world is all good Error The DELETE…
TheGeneral
  • 79,002
  • 9
  • 103
  • 141
0
votes
1 answer

Unexpected row count in Nhibernate when deleting parent records with associated child records

I have a parent table, Orders and a child table, [Order Details], I have setup the fluent mappings as - (In the parent Order class) HasMany (x => x.Details).KeyColumn("OrderId").Cascade.AllDeleteOrphan().Inverse(); (In the child…
ilias
  • 2,620
  • 2
  • 27
  • 37
0
votes
1 answer

Hibernate self Bidirectional OneToMany Cascade remove doesn't work

I have a problem with a self bidirectional relationship does not work cascade remove, i have the following entity that what it does is basically put together a family tree with many levels, if I try something like em.remove (family) it does not…
0
votes
2 answers

mysql query delete multiple tables with single query when the foreign key relationship

I have create blog system. In this blog i have created three tables. Table 1: article +----------------+-----------+-------+-------------+ | article_id(PK) | name | description | +----------------+-----------+-------+-------------+ | 1 …
Aruljothi
  • 497
  • 1
  • 6
  • 14
0
votes
2 answers

how to check whether on delete property is set or not in a foreign key constraint in postgresql?

Is there is any query to check whether "on delete" property is being set or not set in a foreign key constraint in postgresql ?
Rishi Rahiman
  • 272
  • 1
  • 5
  • 14
0
votes
1 answer

EF Code First Cascade Delete not working

I have this model definition and I want to cascade delete on it. With modelBuilder.Entity(Of dbDimension)() .Property(Function(t) t.dbDimensionID). HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity) …
DataAnalyst1
  • 147
  • 2
  • 12
0
votes
1 answer

Play - ebean cascade delete options

I am developing a website and it has quite a lot many to many relationships. This means that usually when I delete something it might be connected to tons of other things which will result in deleting way too many things. In that respect I would…
0
votes
1 answer

Delete object from database when it has dependencies

I was trying to implement the Delete Action in the MVC3, but I got to the point that the object that I want to delete has dependencies in other tables and that's why I am getting: DELETE statement conflicted with the REFERENCE constraint Here is…
inside
  • 3,047
  • 10
  • 49
  • 75
0
votes
2 answers

Introducing FOREIGN KEY constraint 'FK_dbo.OrderDetails_dbo.Order_OrderId' on table 'OrderDetails' may cause

I'm getting this error message from the PMC: Introducing FOREIGN KEY constraint 'FK_dbo.OrderDetails_dbo.Order_OrderId' on table 'OrderDetails' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or…
Quoter
  • 4,236
  • 13
  • 47
  • 69
0
votes
2 answers

Entity Framework object graph deletion with Breeze

I am encountering a recurring problem that just makes no sense, and hoping someone (in the Breeze team?) can shed some light. The following model illustrates the entities in question. As you can see, I'm adhering pretty strictly to Entity…
zpydee
  • 4,487
  • 4
  • 16
  • 19
0
votes
1 answer

Cascade Not Working

I have a couple tables that are weakly connected and I would like the delete to work across both of them when I delete from the main table. Table 1: CREATE TABLE Car( cID INTEGER, color VARCHAR(10), primary key (cID) ); CREATE TABLE Tags( tID…
ZAX
  • 968
  • 3
  • 21
  • 49
0
votes
1 answer

Modular cascading deletion on SQL Server

I have a table (let's call it tMainTable) which is currently referred by many other table (and their number might just grow over time). Several of those tables cannot just have the ON DELETE CASCADE clause due to cycling detection. I know I could…
Serge
  • 6,554
  • 5
  • 30
  • 56
0
votes
1 answer

grails, relations and cascade delete

I have the following domain classes: class Patient { ... } class Receipt{ @NotNull static belongsTo = [patient:Patient] ... } If I try to delete a Patient instance (after creation of Receipt instances), I have a…
FrancescoDS
  • 1,077
  • 4
  • 21
  • 55
0
votes
1 answer

SQL Confused over ON UPDATE and ON DELETE

I need to create a database using sql for my reviews site. I tried to use the on delete and on update constraints but I'm not sure if they are right. I created three tables a 'cars'(my review items) 'reviews'(holds the reviews) and a 'users' one. I…
0
votes
0 answers

Error after delete in update in one transaction (deleted object would be re-saved by cascade)

I'm Using hibernate 4 as jpa provider. In my code I insert a new version of report (to PactRegister), select all version of this report, remove child records (ActRegister), And calculate current active version of report with insert a child…
asu
  • 51
  • 1
  • 8