Re: [Newbie]ManyToMany
Re: [Newbie]ManyToMany
- Subject: Re: [Newbie]ManyToMany
- From: Jonathan Rochkind <email@hidden>
- Date: Wed, 17 Mar 2004 18:57:01 -0600
The problem is, if you expose both the direct relationship and the
flattened relationship, EOF has no idea that both
toIntermediary.toDestination and throughFlattenedRelationship are
supposed to refer to the same set of objects. You make changes to the
relationship through one of those paths, and EOF isn't going to
realize it's supposed to change the other one---object graph
inconstency. You make changes to both... and I'd guess when you save
EOF is going to try and make the same changes twice. Or maybe not,
depending on how things work. But either way, this is confusing for
EOF. David says it's especially bad with delete rules, which kind of
makes sense. But I'd be worried that mysterious problems could crop
up in unexpected places with this kind of modelling. Either model it
as flattened, or model the direct relationships, but don't model both
as class properties.
(Anything that's not a class property is essentially out of the
picture, and only used for fetches, not for anything involving the
object graph in memory. In the case of flattened relationships, the
non-class-property direct relationships are of course used by EOF to
figure out how to fetch and modify the 'flattened' relationship! But
in general, you can model whatever the heck you want as a
not-class-property, and still use it for EOQualifiers to the database
for instance, and be confident that even if you've done something
really weird with a not-class-property relationship or attribute,
it's not going to mess up EOF at all. Generally, if it's not a class
property, EOF pretty much ignores when doing all it's mysterious
magical stuff.]
At 7:26 PM -0500 3/17/04, Kieran Kelleher wrote:
Thanks for the experience tip. I am still on my first big project
and although EOModeler seems to allow this kind of flattening
through an object, I had not seen bad effects yet. I supose we must
follow the keypaths!
On Mar 17, 2004, at 6:44 PM, David LeBer wrote:
On 17-Mar-04, at 5:48 PM, Jonathan Rochkind wrote:
At 5:26 PM -0500 3/17/04, Kieran Kelleher wrote:
Forget having EoModeler make a many-to-many.
Just make relationships such as:
T1 <=>>T2 and T2<<=>T3, (where > is a to-one and >> is a to-many)
then you can use T1.T2.T3(), T3.T2.T1() and also use flattened
T1.T3() or T3.T1()
How could you use those flattened relationships from T1 to T3?
Are you suggesting defining the flattened relationship in the
EOModel as a class property, and ALSO defining the direct
relationship as a class property? I think this is rather a bad
idea myself, but if you've done it succesfully I'm interested in
hearing about it.
Otherwise.... how could you "also use flattened T1.T3() or
T3.T1()"? My experience is you either use flattened relationships,
or you don't. If you don't (perhaps because you need exposed
attributes in the intermediary table), then you've got to go
through the intermediary table to get from T1 to T3 or vice versa.
--Jonathan
I concur, having a both flattened and unflattend relationships as
class properties at the same time is a bad thing. I know, I speak
from experience :-) Especially if you have a cascade delete rules
in place - mucho badness occurs.
;david
--
David LeBer
Codebase Software Systems
site: http://www.codebase.ca
blog: http://david.codebase.ca
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.