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

Entity Framework only performs cascading delete when debugging

I've got the following classes: public class Discount { public override int Id { get; set; } public virtual IList Regions { get; set; } } public class Region { public override int Id { get; set; } public int DiscountId {…
Tom
  • 1,561
  • 4
  • 20
  • 29
0
votes
0 answers

Entity Framework 5 Fluent mapping nested "many to many" to "many to many" cascades

We have the following case: Image of the DB model We are trying to map with fluent in EF so that when a RoleUser is deleted, all the UserRoleCollection are deleted with cascade. The class RoleUser does not exist in the EF model, because it is a many…
0
votes
1 answer

MS SQL - How to deal with multiple cascade paths

I have the following connection in my database (Example) Table 1: Car {id, name} Table 1: CarPart {id, name, CarId} Table 1: CarPartDealer {id, name, CarId, CarPartId} Step 1. I have define cascade on the relation between car and car part so that…
Bick
  • 17,833
  • 52
  • 146
  • 251
0
votes
1 answer

One to Many Casade Deletes

When deleting a parent record I would like EF to delete the child records and not have to do the following: public Foo { [Key] public int FooID { get; set; } public string Foo_Name { get; set; } //One to many with bar public…
0
votes
1 answer

How to null self-referencing fk on delete of parent in EF5 - Code first

I have a Question Entity. My entity contains a CreatedFrom of type Question that contains a reference to the question it was created from. So a self reference. Now I use the CreatedFrom to update the original question as long as it's around. But the…
0
votes
1 answer

delete with dapper or other aproach with performance and fast

I want delete data from database that tables have relation i should query with tables for delete data from parent and child with dapper. this is very slow . i delete alot data(millions record) 45 second but delete Several rows perform in 2…
0
votes
1 answer

cakephp delete casade with sub-categories

Using cake 2.x I have 3 tables (I've shortened the names for this example removing the plural/singular cakephp conventions): Main (has many Sub1) Sub1 (belongs to main, hasmany Sub2) Sub2 (belongs to sub1) When I delete a category from Main, all…
user6972
  • 851
  • 1
  • 15
  • 32
0
votes
1 answer

JPA Event to delete Entity from DB fired by deletion of an Entity from another Persistence Unit

in the application that I am working on, somebody split the domain objects into different persistence units. The connection between tables from different persistence units is made based on columns containing the ID for instance: TableA …
Olimpiu POP
  • 5,001
  • 4
  • 34
  • 49
0
votes
2 answers

NHibernate Many To Many Relationship - Issue when deleting a part of the relationship

I have a many to many relationship between a Team and an Employee entity. I mapped them as following: public class EmployeeMap : ClassMap { public EmployeeMap() { // identifier mapping Id(p =>…
Rookian
  • 19,841
  • 28
  • 110
  • 180
0
votes
1 answer

Many-to-one cascade delete NHibernate results in RESTRICT (MySQL 5)

I've a simple category class. Each category can have zero or more children of type category. Therefore I have chosen to register the parent of a category, which can be null or the id of another category. When a category is deleted, all its children…
Mike de Klerk
  • 11,906
  • 8
  • 54
  • 76
0
votes
0 answers

How can I delete an inherited class in JPA with cascade delete?

The question may seem a little bit of confusing so I'll try to bring it on with examples. I'm working with JPA 2.0 and Eclipselink 2.2 I've got three classes Person, Student and Credentials wich have this relationship: Student inherits (extends)…
0
votes
1 answer

sqlite3 delete on cascade with Delphi XE Zeosdb Tztable

I have two tables Client , Commande The DDL in sqlite3 is the following , CREATE TABLE Client ( id_client INT NOT NULL, nom varchar(10), PRIMARY KEY ( id_client ) ); CREATE TABLE Commande ( id_commande …
Bessoufi Mounir
  • 1,368
  • 1
  • 8
  • 7
0
votes
0 answers

Hibernate deletes parent from a ManyToOne relation?

If you are working a lot with CascadeType.ALL it is easy to get to the following design: @Entity public class Group { ... } @Entity public class Person { @ManyToOne(cascade = CascadeType.ALL) Group group; ... } Which tells Hibernate to…
adler
  • 949
  • 1
  • 9
  • 10
0
votes
1 answer

Ignoring outputs in Cascading

I am analyzing log files with various domain names. I want to exclude/ignore from the output report any domain that has the word "macys". Here is an example output: l.macys.com 87516 www.google.com 3016 search.yahoo.com 584 www.bing.com…
cevallos.valtira
  • 191
  • 1
  • 1
  • 8
0
votes
1 answer

How to retrieve associated data in hibernate

I have a problem. I have a domain that has child data. I can easily delete it by using Cascade delete but my teacher said that I must not cascade it. My plan is when the data has associations I will retrieve the associated and show it to the user.…
NinjaBoy
  • 3,715
  • 18
  • 54
  • 69