cascade

What is the problem with foreign key cascade multiple paths and cycles?

In MSSQL 2005 I just struck the infamous error message: Introducing FOREIGN KEY constraint XXX on table YYY may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints. Now, StackOverflow has several topics about this error message, so I've already got the...

NHibernate collection cascade changes auditing

Given the following object model class Test { ... public string Name {get;set;} public IList<Test2> Collection {get;set;} //mapped with cascade="all" } class Test2 { ... public string Name {get;set;} } and code sample var test = new Test(); test.Collection.Add(new Test2(){Test=test,Name="1"}); //saving new entity with N...

how to define an inverse cascade delete on a many-to-one mapping in hibernate

I have two classes A and B. Many B's can have association with a single A, hence a many-to-one relationship from B to A. I've mapped the relationship like: <class name="A" table="tbl_A"> <property name="propA" column="colA"/> </class> <class name="B" table="tbl_B"> <property name="propB" column="colB"/> <many-to-one name="a" class...

Oracle cyclic foreign key references issues.

I've been racking my brain trying to come up with a solution to this. For a database class, I need to implement the following: Table HUSBANDS: (Name Varchar2(10)) (Wife Varchar2(10)) Table WIVES: (Name Varchar2(10)) (Husband Varchar2(10)) and using Oracle constraints, enfore the following rules: No two husbands can have the same na...

SQL Server: Self-reference FK, trigger instead of ON DELETE CASCADE

Hello, I need to perform an ON DELETE CASCADE on my table named CATEGORY, which has the following columls CAT_ID (BIGINT) NAME (VARCHAR) PARENT_CAT_ID (BIGINT) PARENT_CAT_ID is a FK on CAT_ID. Obviously, the lovely SQL Server does not let me use ON DELETE CASCADE claiming circular or multiple paths to deletion. A solution that I see o...

Jquery.cascade plugin change the format of the Ajax URL

I'm using the jQuery.Cascade plugin in my Asp.Net MVC application. I've got it all working in a manner as follows: jQuery("#CompareModelList").cascade("#CompareManufacturerList", { ajax: { url: '/Home/Models' }, template: commonTemplate, match: function (selectedValue) { return this.Manuf...

Interface for Open Cascade in Delphi

I am trying to find a way to use Open Cascade(www.opencascade.org) - 3D Modeling Technology in one of our software which is written in Delphi. I did manage top find an ActiveX which supports Open Cascade, but on trying it I did not like the visual quality of rendered images. The ActiveX lib can be found here (www.ewcad.com). I am not ...

Nhibernate Cascade

What does Cascade in Nhibernate mean? I see a lot of options in cascading: Delete All AllDeleteOrphan DeleteOrphan SaveUpdate Can you explain these with with examples and their distinctions? ...

NHibernate cascade settings for Roles based authentication

My object model Person _______ public IList<Role> Roles { get; set; } public IList<Group> Groups { get; set; } Group _____ public IList<Role> Roles { get; set; } Role ____ public string Role { get; set; } So pretty much a standard roles based model, a User can exist in zero to many groups which have roles assigned to them, and can e...

NHibernate Cascade none still updating related entity.

Hi, I am then using Fluent NHibernate and its automapping feature to map the the following simplified POCO classes: public class Webpage { public virtual int Id { get; set; } public virtual string UrlIdentifier { get; set; } public virtual WebpageType WebpageType { get; set; } } public class WebpageType { public vi...

NHibernate Definitive Cascade application guide

Are there any internet resources that have a definitive guide to all of the cascade settings for NHibernate that will include examples of the class structure, HBM and the implications of actions with each of the cascade settings for all of the relationships with NH. Also it would be helpful if there were examples for common associations...

CSS: are images requested if stated in CSS but later over-ridden?

I'm building a web site that uses a fair amount of drop shadows and gradients. I can accomplish a lot of this via CSS's box-shadow properties. Alas, we're still supporting IE, so we need to add background images in those situations. I could be lazy and just give everyone the background images, but I'm trying to streamline things for t...

How to properly cascade delete managed objects in Core Data?

I have a Core Data model which has three entities: A, B, and C. A has a one-to-many relationship with B, and B has a many-to-many relationship with C. The delete rule for A -> B is "Cascade", and B -> A is "No Action". The delete rule for B -> C is "No Action", and C -> B is "Deny". I am having trouble performing a delete on the A entit...

Hibernate many to one delets all parents when a child is deleted

I have Country and State objects. I intend to have unidirectional many to one relationship from State to Country. I don't want to store any references to States in Country I have defined mapping as below. When I delete even one State object, all Countries are deleted! <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hib...

Hibernate bi-directional many-to-many cascade confusion

I'm a hibernate newbie and I'm not entirely sure how to get the cascade behavior I'm looking for. Let's say I have two classes A and B with bi-directional many-to-many mappings to each other. A is the owner side and B is the inverse side (I hope I have the terminology correct). public class A { private Set<B> bSet = new HashSet<B>(...

How to setup Hibernate @ManyToMany association with cascades on both foreign keys?

I'm trying to map a @ManyToMany association using hibernate. But so far I only managed to have cascade on one of the foreign keys. My source code goes like this: @Entity public class Airplane { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; @OnDelete(action=OnDeleteAction.CASCADE) @ManyToMany(m...

Why delete-orphan needs "cascade all" to run in JPA/Hibernate ?

Hello, I try to map a one-to-many relation with cascade "remove" (jpa) and "delete-orphan", because I don't want children to be saved or persist when the parent is saved or persist (security reasons due to client to server (GWT, Gilead)) But this configuration doesn't work. When I try with cascade "all", it runs. Why the delete-orphan ...

How can I delete child objects when the parent is deleted in rails?

model a: has_many :b, :dependent => :delete_all model b: belongs_to :a belongs_to :c model c: has_many :b When I delete an a, I would also like to have children b's deleted so that they get removed from any c's that may reference them. However, the above isn't working. I'd appreciate any help. ...

Is it bad to rely on foreign key cascading?

The lead developer on a project I'm involved in says it's bad practice to rely on cascades to delete related rows. I don't see how this is bad, but I would like to know your thoughts on if/why it is. ...

T-SQL: DROP Table cascade constraints equivalent?

In oracle, I can issue a DROP TABLE ... cascade constraints and it won't complain about FKs, etc. Is there an equivalent in T-SQL? ...