cascade

What is best practice about having one-many hibernate

Hi all, I believe this is a common scenario. Say I have a one-many mapping in hibernate Category has many Item Category: @OneToMany( cascade = {CascadeType.ALL},fetch = FetchType.LAZY) @JoinColumn(name="category_id") @Cascade( value = org.hibernate.annotations.CascadeType.DELETE_ORPHAN ) private List<Item> items; Item: @ManyT...

Hibernate. 2 functions : simpleSave() , saveWithCascade() . can it be done ? and how ?

I have a scenario in which i have: A parent class Parent which has some simple properties (int, String, etc) and 2 set of children. Set childrenA; Set childrenB; Could i make a save function for parent simpleSave(Parent p) that will save/persists only the parent properties in the database and have a function saveWithCascade(Parent p) t...

CascadeType problem in One to Many Relation

Hi I have two classes which have a Unidirectional One to Many relation with each other. public class Offer{ ... @OneToMany(cascade=CascadeType.ALL) @JoinTable(name = "Offer_Fields", joinColumns = @JoinColumn(name = "OFFER_ID"), inverseJoinColumns = @JoinColumn(name = "FIELDMAPPER_ID")) private Set<FieldM...

Hibernate cascade debug options

I have run into various StackOverflowErrors which occur during cascading. These have been extremely time consuming in debugging because I don't know which properties are being cascaded to cause this recursive behavior. Does anyone know of a log setting or some other form of debugging which could tell me specifically what properties are b...

What is the performance impact of CSS's universal selector?

I'm trying to find some simple client-side performance tweaks in a page that receives millions of monthly pageviews. One concern that I have is the use of the CSS universal selector (*). As an example, consider a very simple HTML document like the following: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ...

Microsoft Access Query To Build Relationship

Hi, I have the following table: Table Parents with columns ID and FullName. ID is a primary key of type Auto-Number. Table Children with columns ID, ParentID and FullName. ID is a primary key of type Auto-Number. ParentID is of type Number. I want to use the following query to build a "cascade deletion" so that when a parent is del...

MySQL InnoDB Cascade Rule that looks at 2 columns?

I have the following MySQL InnoDB tables... TABLE foldersA ( ID title ) TABLE foldersB ( ID title ) TABLE records ( ID folderID folderType title ) folderID in table "records" can point to ID in either "foldersA" or "foldersB" depending on the value of folderType. (0 or 1). I am wondering: Is there a way to create a CASCAD...

NHibernate ManyToMany Relationship Cascading AllDeleteOrphan StackOverflowException

I have two objects that have a ManyToMany relationship with one another through a mapping table. Though, when I try to save it, I get a stack overflow exception. The following is the code for the mappings: //EventMapping.cs HasManyToMany(x => x.Performers).Table("EventPerformer").Inverse().Cascade.AllDeleteOrphan().LazyLoad().ParentKeyC...

MongoDB DBRef ON DELETE CASCADE

Is there a way in MongoDB to have a foreign key with a 'ON DELETE CASCADE' functionality? I know you can use DBRef as a sort of foreign key but when the item in a collection where the reference points to is removed, the reference returns null. But i want that the item where the reference belongs to gets removed. How do i do this? Or do...

SQL: How to refactor this multi-table delete statement

Can anyone suggest a cleaner method to delete rows with a one-to-many relationship in one query? This works, but I'm not very familiar with the using clause or delete, so I don't fully understand how it works. DELETE FROM ip_record, entry using ip_record inner join entry where ip_record.site_id = ? ...

Injected link stylesheet takes precedence over existing styles in IE7+

There seems to be a bug in IE when cascading dynamic stylesheets. Does anyone know if there is a workaround? Consider this: <head> <style>#test{background:red;}</style> </head> <body> <div id="test">test</div> <script> var link = document.createElement('link'); var style = document.getElementsByTagName('style...

Hibernate - One to many relationship and orphanRemoval cascade

Hi, I have a basic one to many relation parent / child like in the chapter 21 of Hibernate references book. The cascade is only from child to parent (persist cascade only because I don't want to delete the parent if I delete a child). When I add a child to the parent and I save the child, I have a TransientObjectException... @Entity pu...

SQL Server Multiple cascade sequence

Assume Table A has two children tables, B and C with cascade delete between A-B, and cascade delete between A-C. When a row is deleted in A, the matching rows from B and C are deleted. How does SQL Server determine the order of the Cascades to fire? What I need is to fire the A-C cascade delete before the A-B cascade delete fires. I k...

Hibernate or Grails - Need help understanding cascade

Hi, I am a college student who do not have a lot of experience on Hibernate or Grails. The main question that I have is mainly about where does cascading apply, does it apply only to attributes where there is an database entry for it or other wise? so for example If I have 2 Domains A and B... where B has hastable that is filled with A...

Hibernate all-delete-orphan on a child class with two parent classes

I'm looking into a problem, where there are two "parent" classes, P and Q that cascade all-delete-orphan to a "child" class, C. My intuition in Hibernate tells this is really a bad idea and I am getting an error message that probably confirms this when the code deletes an instance of P (i.e. session.delete(myP); ): "deleted object would...

NHibernate cascade update/insert

I have a Case class which exposes a Person object as follows: public class Case { public virtual Person Deceased {get;set;} } I have a PersonalAsset class which also exposes a Person: public class PersonalAsset { public virtual Person Owner {get;set;} } Assuming I write the following code within an ISession: Case case = new Ca...

Grails cascading behavior

Hi, I am stuck at this problem. The code looks ok to me(obviously I am missing something. The question is what it is?) I have a Project class def class project{ ... Manager manager } This is Person and Manager class definition def class Person{ String firstName String lastName } def class Manager extends Person{ ...

PostgreSQL 'Deferrable Delete' still hits constraint on Delete

I want to delete rows from two tables which have a dependence upon each other through a set of deferrable constraints. To simplify this post, I've mocked up a simple DB schema. I'm hoping to remove entries from some table, 'delete_from_me', inside a SQL transaction/DB Patch. The catch is, I want to delete based on a select from a second...

Django: merging objects

Hello! I have such model: class Place(models.Model): name = models.CharField(max_length=80, db_index=True) city = models.ForeignKey(City) address = models.CharField(max_length=255, db_index=True) # and so on Since I'm importing them from many sources, and users of my website are able to add new Places, I need a way to...

Cascade tree deleting in MS SQL Server Express 2005

One table has name "Stages", every Stage can have 0..infinity childrens, in table Stages there are column named Parent. This column is foreigh key for same table Stages. How to make cascade deleting in this tree? I want to on deleting any row in this table, auto delete all their childrens and childrens of their childrens....etc При тако...