We've got a database that generally has this structure:
Master Record Table
id (pk)
MasterRecordId <-- constrained to be unique
Children/Siblings (2nd Generation, if you will):
Table1
( table1ID (pk),
MasterRecordID (fk))
Table2
( Table2ID(pk),
MasterRecordID (fk))
Grandkids (3rd Generation):
Table3
( Table3ID (pk)
Table1I...
Hi all,
This one is for the Grails users here. I asked it on the grails - user mailing list, but I figured since I've been fighting this for a couple of days I should cast as wide a net as possible.
I'm having some difficulty with trying to model relationships between two
objects of the same type in another object (different type) ref...
I have a 3 tables that look like this:
On the foreign keys I have set cascade deletes.
Right now, when I delete a record in the Folder table, only the related record in the FolderItem is deleted.
This is expected and correct.
What I would to accomplish is when I delete a record in the Folder table, the corresponding records in the Fo...
I have a model in rails with one_to_many relationship. When I delete the father, I'd like to delete all childrens. How should I do it? I want to delete all orders and its items when I delete a user
My models are:
class User < ActiveRecord::Base
has_many :orders, :foreign_key => "id_user"
end
class Order < ActiveRecord::Base
has_ma...
i have one simple table with following columns: id, name and parentID
i created relationship diagram between id and parentID (on a same table), like simple tree, on the same table, but when i tried to user cascade delete it was disabled for me
i know that it will be recursive delete if i will delete parent it will delete his children
...
This question is probably a long shot. I can't figure out the errors I'm getting on my core data project when I save after I delete an entity. My .xcdatamodel can be seen at:
http://jump.fm/BXRCG
I have two main entities that I work with, an Outfit and an Article. I can create them with no problem but when I delete them I get the fo...
Is there a difference between :
@Cascade(org.hibernate.annotations.CascadeType.REMOVE) and
@Cascade(org.hibernate.annotations.CascadeType.DELETE) ?
...
My data model has some complex relationships where I have to remove objects from associations before I delete them from NHibernate. However, I am currently getting
NHibernate.ObjectDeleteException {"deleted object would be re-saved by cascade (remove deleted object from associations)[Model#12344566]"}
I'm sure the issue is with my cod...
I have a hierarchy of tables 3 levels deep (QualificaionType has many QualificationGroups, which have many Qualifications) mapped like this:
// QualificationType
HasMany(x => x.QualificationGroups)
.Inverse()
.KeyColumns.Add("QualificationGroupId")
.AsBag()
.Cascade.AllDeleteOrphan()
.Access.CamelCaseField(Prefix.Und...
I have a many to many relationship between a Team and an Employee entity.
I mapped them as following:
public class EmployeeMap : ClassMap<Employee>
{
public EmployeeMap()
{
// identifier mapping
Id(p => p.Id).Column("EmployeeID");
// column mapping
Map(p => p.EMail);
Map(p => p.LastName)...
I am using Fluent NHibernate Automapping and am pretty new to this framework.
I have a 'Tab' object which has a single reference to another object 'Caption'.
When using Automapping, this relation is generated in the hbm file as a many-to-one relationship with cascade="all" as I have used the Cascade.All() setting for this.
Because of t...
Hi -
I am attempting to delete all rows in two dependent tables based on a third tables ID.
Table structure:
Transaction
-Transaction_ID (primary)
-Timestamp
Purchase
-Item_ID
-Transaction_ID
-Purchase_ID (primary)
Item
-Item_ID (primary)
-Client_ID
I would like to delete all rows from transaction/purchase that match the Client_ID...
Hi all,
I think I have the use of reference constraints in RDBMS's a bit mixed up.
Take this example for instance:
Table folder
Table file (with FK_folder)
A file record is a child of a folder record.
When I want a user to delete a folder I want to warn them if there are files located in the folder.
Usually I would therefor put ...
I have two classes A and B with a many-to-one relationship from A to B (multiple A objects may reference the same B). The question is, if the delete rule on the A side is Cascade, will B be deleted only when the last referencing A is deleted or will it be deleted the first time an associated A is deleted. The delete rule for the B side...
Hi,
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<OrderDetails>
(x => x.Details).KeyColumn("OrderId").Cascade.AllDeleteOrphan().Inverse();
(In the child [Order Details] class)
References(x => x.ParentOrder).Column("OrderId").Not.Nullable(...
I have an object called "Customer" which will be used in the other tables as foreign keys.
The problem is that I want to know if a "Customer" can be deleted (ie, it is not being referenced in any other tables).
Is this possible with Nhibernate?
Thanks
...
I want to be able to choose a groupID and do a cascading delete through three tables which are found in a MS SQL server database. The tables look like the following:
table 1 - GROUP
-------------------------------------------
groupID | description | etc
table 2 - MEMBER
-------------------------------------------
memberID | name | et...
The scenario is as follows,
I have 3 objects (i simplified the names) named Parent, parent's child & child's child
parent's child is a set in parent, and child's child is a set in child.
mapping is as follows (relevant parts)
parent
<set name="parentset"
table="pc-table"
lazy="false"
fetch="subselect"
cascade="a...
I have the following table setup.
Bag
|
+-> BagID (Guid)
+-> BagNumber (Int)
BagCommentRelation
|
+-> BagID (Int)
+-> CommentID (Guid)
BagComment
|
+-> CommentID (Guid)
+-> Text (varchar(200))
BagCommentRelation has Foreign Keys to Bag and BagComment.
So, I turned on cascading deletes for both those Foreign Keys, ...
Django models generally handle the ON DELETE CASCADE behaviour quite adequately (in a way that works on databases that don't support it natively.)
However, I'm struggling to discover what is the best way to override this behaviour where it is not appropriate, in the following scenarios for example:
ON DELETE RESTRICT (i.e. prevent del...