Re: Editing context not reflecting edits?
Re: Editing context not reflecting edits?
- Subject: Re: Editing context not reflecting edits?
- From: Chuck Hill <email@hidden>
- Date: Tue, 28 Sep 2004 07:44:47 -0700
I suspect you model had issues. Perhaps you were missing a back
pointing relationship somewhere. Or there was more than one and EOF
got confused.
Chuck
On Sep 27, 2004, at 9:49 PM, Owen McKerrow wrote:
I sometimes have the same problems even when I use
addObjectToBothSidesOfRelationshipWithKey. WhatIve found however if
say I saying
aUser.addObjectToBothSidesOfRelationshipWithKey(aGroup,"groups");
and changed that to
aGroup.addObjectToBothSidesOfRelationshipWithKey(aUser,"users");
it works fine. Something to do with which object you add the
relationship to.
Mind you if you log out and then come back in ( i.e. get a new session
) it works fine anyways. Seems that for some reason ( may be my bad
model ) but setting it one way makes all the right entries in the Db
but the other Java Object doesn't get updated.
I hope that makes some kind of sense.
owen
On 28/09/2004, at 2:22 PM, Chuck Hill wrote:
Are you using addObjectToBothSidesOfRelationshipWithKey to make the
User / Group membership relation? If not that is your problem.
Otherwise, I'd check the model. Something is amiss.
Chuck
On Sep 27, 2004, at 4:19 PM, Benjamin Adair wrote:
Woo, two messages in a day. I can't get enough of you all. :)
So, I worked around my PK as attribute deal but stumbled upon
something else that really has stumped me.
In one component, the user editor, the user adds a group membership
and saves. My component gets the default editing context from the
session and tells it to save the changes. (I watch the database log
and see that correlation table between users and groups does in fact
get an insert.) Next the user clicks on the link to go to the group
editor, within which I use the same default editing context method
via the session to retrieve the list of groups. Except here, I'm not
seeing that user that was just added to the group.
When the save button is hit the changes are automagically taken from
the request and saved thusly:
// Save the changes made in the editing context to the database
session().defaultEditingContext().saveChanges();
and then later, in the groups component I use this to generate the
list of groups:
// Build the fetch specification to fetch the complete list of web
groups
groupsFetchSpec = new EOFetchSpecification( "WebGroup", null,
sorting );
...
return
session().defaultEditingContext().objectsWithFetchSpecification(
groupsFetchSpec );
Thoughts? Why, when I make an edit to a group, will I see that edit
reflected in the user component, yet not the other way around? My
relationships (flattened through the many to many) are exactly the
same, option-wise.
Thank you muchly,
Ben
-- Benjamin Adair
Central Office Database Programmer/Analyst
Cancer & Leukemia Group B
Phone: 773-702-6731
Fax: 312-345-0117
Email: email@hidden
Web: http://www.calgb.org/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
--
Practical WebObjects - a book for intermediate WebObjects developers
who want to increase their overall knowledge of WebObjects, or those
who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - -
People who prefer typing to pointing then seem to prefer acronyms to
save typing :-)
-Denis Stanton, On people using Command Line Interfaces
--
Practical WebObjects - a book for intermediate WebObjects developers
who want to increase their overall knowledge of WebObjects, or those
who are trying to solve specific application development problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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