Re: Relationship consistency maintenance
Re: Relationship consistency maintenance
- Subject: Re: Relationship consistency maintenance
- From: Simon McLean <email@hidden>
- Date: Mon, 16 Jul 2007 08:28:45 +0100
Sounds like a problem with your model to me. When using
addObjectToBothSides... you should *never* have to set the back
relationship manually.
Simon
On 16 Jul 2007, at 06:25, Tarun Reddy wrote:
I have an app where a User has a list of Ideas associated with it.
I use the following code to set that relationship:
aNewIdea.addObjectToBothSidesOfRelationshipWithKey(session.getUser(),
"Ideasuser");
However, unless I add this:
session.getUser().addToIdeas(aNewIdea);
then even though the database is correctly updated, User.getIdeas,
isn't up to date. Is it best practices to have both of these
relationships set? And do I need to go further and do a
aNewIdea.addUser(session.getUser());
to maintain that reverse relationship in memory? Or am I making
this harder than it seems...
Thanks,
Tarun
_______________________________________________
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