Re: deleting and many to many
Re: deleting and many to many
- Subject: Re: deleting and many to many
- From: Frank Stock <email@hidden>
- Date: Mon, 13 Aug 2007 15:12:30 +0200
Hi John,
Op 13-aug-07, om 14:47 heeft John Larson het volgende geschreven:
Hi Frank,
A couple of comments. Generally, the primary key for the many to
many relationship is the combination of the two primary keys that
the table is linking together. It may be possible for it to work
without it set up like that, but I've never done it. Secondly,
there are usually six key relationships in many-to-many
relationships. In your case, RB and RA should have "nullify" as
their delete rule.
This is the case, but why use nullify instead of no-action? I can see
that, if you do a delete, the to-one relation will be executed, if
that related row contains a to-many relation, that will be loaded to.
So, if you have e complex model with many relations, if I use no
action, a delete will perform many less selects.
The cardinality should be "to one" and the optionality should be
"mandatory." The next two relationships are the inverse ones: BR
and AR. They should be to-many and optional. They should have
"cascade" as their delete rule. None of those four relationships
need to be class properties. The last two relationships are the
actually to-many relationships that are defined as BR.RA or AR.RB.
Those are the only relationships that you should have to work with
(unless the link table has specific info you want to get).
Is that what your setup looks like? If so, and it still doesn't
work, then you may have to dig deeper. I've been stumped by nearly
every type of frustrating relationship imaginable and it almost
always comes down to me swearing that my model is right, but
finding out that I am wrong. Even if it is "right" by normal human
logic, EO have very little tolerance for other opinions of what is
right and wrong and won't work if it isn't the way it wants it.
Could my problem have something to do with using one primary key and
two foreign keys in my relation-table?
John
On Aug 9, 2007, at 6:52 AM, Frank Stock wrote:
Hello,
I have a table A and B and a many to many relation R between A en B.
The relation-table R has a primairy key and the relation RA to A
and RB to B. (RA and RB can't be null)
I see that there are a few rows in R where RB is 0 or RA is 0 or
(RA and RB are 0), a few have a RB with no link to B, so if we
delete A, we get an error.
The EOmodel is OK so, if we delete B, the cascade is working to
delete related R's.
How can RA or RB get 0? Where do I have to look??
We have about 1% errors.
Thanks for advice.
Frank Stock
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden