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
2 answers

Is it possible to delete a collection of root entities with all their children using NHibernate

Here's my problem: I have a set of ids. These are the ids of a collection of root entities. Now I want to delete all these root entities, efficiently. I can't do a WHERE Id IN (1, 2, 3) type of clause, as I'm deleting root entities with…
Peter
  • 13,733
  • 11
  • 75
  • 122
0
votes
2 answers

Hibernate: cascade deletion of a child collection

Suppose I have 2 Java objects: Parent and Child. The relationship between them is Child -> Parent = many-to-one, i.e. a number of Child objects can be associated with the same Parent. A Child object is holding a reference to its Parent meanwhile…
preeze
  • 1,061
  • 1
  • 12
  • 18
0
votes
0 answers

JPA Cascading removal of parent and Child

I'm trying to learn and understand JPA, and just have a couple of questions regarding deleting a parent and its children in one go. I'm using OpenJPA and EJB3. I have two entities, a Category and a Product. A Category contains many products and a…
zargarf
  • 633
  • 6
  • 18
0
votes
1 answer

NHibernate - SQL Server CE - Delete Cascade not working

I have two tables: Receipt ReceiptJournal Receipt has 0...n ReceiptJournals The mapping for this (in Receipt) looks like: this.HasMany(x => x.ReceiptJournals).AsSet().Fetch.Select().Inverse().Cascade.Delete(); The underlying database which I use…
BennoDual
  • 5,865
  • 15
  • 67
  • 153
0
votes
3 answers

DB down on executing delete query

Is there a possibility that a simple delete query can bring down a DB? We executed a delete query (single row deletion) and that query hung. When multiple people tried executing the same delete again, the Oracle DB is down. Multiple tables…
RJ.
  • 313
  • 2
  • 5
  • 14
0
votes
2 answers

How do I integrate embedded RavenDB and CascadeDelete bundle?

I'm trying to implement cascading deletes in this application which embeds RavenDB, via the CascadeDelete RavenDB bundle, but the bundle doesn't seem to be activated. How should I go about this? In the below code snippet is a test console…
aknuds1
  • 65,625
  • 67
  • 195
  • 317
0
votes
2 answers

One to many relation with cascade giving error

I am learning EF Code First with migrations, I have 3 entities : [User] 1--->* [Call] 1--->* [ETA] Code : User.cs public class User { [Key] public int Id { get; set; } public Guid LongId { get; set; } [Required] public string…
0
votes
1 answer

What is the appropriate annotation for a cascading delete on a JoinTable?

I'm using Hibernate 4.1.0.Final, Spring 3.1.1.RELEASE, and MySQL 5.5. I have this entity ... @GenericGenerator(name = "uuid-strategy", strategy = "uuid.hex") @Entity @Table(name = "user") @Cacheable public class User implements Serializable { ……
Dave
  • 15,639
  • 133
  • 442
  • 830
0
votes
1 answer

Force Hibernate to delete joining table rows

I am a bit confused as I can't force Hibernate to remove the rows in the joining table. Probably I need to configure something differently. I have a table Component and Task and a table the connects them Component_Tasks. In my class Component I…
Boris Horvat
  • 563
  • 2
  • 13
  • 28
0
votes
1 answer

C#, Entity Framework and delete child registers in SQL Server 2008

I know that in SQL Server I can use delete on cascade when I delete a parent row in a table, but in some places I read that is better to implement this logic in the application (repository) instead of delete on cascade in SQL Server. So I have two…
Álvaro García
  • 18,114
  • 30
  • 102
  • 193
0
votes
1 answer

Deleting on cascade EntityManager

Here is the situation : I have 2 entities Trader and client : - one client is associated to one trader - one trader could be associated to one or many clients while deleting a trader using EntityManager.remove(t) then commit, all the clients…
WOlF
  • 115
  • 1
  • 8
0
votes
2 answers

When is on delete cascade unuseful?

I have a parent table say A and a child say B and B references A's primary key so most people will use on delete cascade to modify the tables when they delete from the parent A. My question is: is there any example of a situation that I WILL NOT…
CSawy
  • 904
  • 2
  • 14
  • 25
0
votes
1 answer

Core Data inverse relationship and deleting unused objects

I have a Core Data model similar to this: When a Webgallery or Article object gets saved, it may use one or many pictures. They can use the same photographical subject but maybe in different sizes. I don't save pictures that don't get used in…
Norbert
  • 4,239
  • 7
  • 37
  • 59
0
votes
2 answers

Delete the User Entity and all the data related to the Entity in Core Data

I have a Core data model like the User Entity having relationship with multiple entities. I need to delete all the entities that is related to User entity when i try to remove the user in core data. How to achieve this?
Vignesh Babu
  • 670
  • 13
  • 30
0
votes
1 answer

Cascading delete for optional inverse joins

There is a following simplified mapping for one of our entity classes:
JustAMartin
  • 13,165
  • 18
  • 99
  • 183