Re: Relationship consistency maintenance
Re: Relationship consistency maintenance
- Subject: Re: Relationship consistency maintenance
- From: John Larson <email@hidden>
- Date: Mon, 16 Jul 2007 12:53:36 -0500
Tatum,
You REALLY don't want to expose primary keys like that. If you want
to get to a record by primary key value, then use EOUtilities
objectForPrimaryKey or objectForPrimaryKeyValue. Similarly, use
EOEditingContext primaryKeyForObject if you want to get the primary
key value.
John
John Larson
Sent from my iPhone
On Jul 16, 2007, at 10:31 AM, Tarun Reddy <email@hidden> wrote:
This may be the cause of my problem. I didn't seem to need to add
the relationship manually until I unhide the primary key from the
object entity. I wanted access to the key so I could create
DirectActions to the Ideas and Users.
I will attempt to verify that this is indeed the cause of the
problem, but if it is, what are people doing for this?
(The other problem is that my model may in fact be messed up. I
reorganized my Java objects into packages around the same time and
didn't touch my EOModel. This may be the root of my problem.)
Thanks for the suggestions!
Tarun
On Jul 16, 2007, at 8:19 AM, Randy Wigginton wrote:
I have had problems that are similar when make the primary key an
object entity. EOF *really* likes to hide the ID from the
programmers, and seems to get annoyed when you want to see it.
On Jul 15, 2007, at 10:25 PM, 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:
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
_______________________________________________
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