Re: Need to perform another fetch?
Re: Need to perform another fetch?
- Subject: Re: Need to perform another fetch?
- From: Chuck Hill <email@hidden>
- Date: Mon, 12 Apr 2004 09:14:15 -0700
On Apr 11, 2004, at 9:20 PM, Bill Reynolds wrote:
I have a component that does a great deal of work and after the user
has
made a bunch of choices I end up with a correctly fetched record. I
perform
some actions on it, save it, etc.
After all that is said and done I'm left with my object, an enterprise
object, we'll call it "MyUserClass". I want to pass this into another
component for some further operation, but because of my design I don't
keep
it in the Session (an obvious mistake on my part).
It sounds to me like putting it in the Session would be a mistake.
So I've created a
variable in the new component for storing it, and I can easily pass it
in
after I create the new component.
That is the right way to do this.
My question is this... Once I have "MyUserClass" object in my new
component,
how do I update it and save changes? Do I need to pass along the
EditingContext with it somehow?
Each eo object knows its editing context, but you should save a
reference to it if you are not using session.defaultEditingContext().
To save changes just
myUserClass().editingContext().saveChanges();
I did the obvious beginner stuff, that is to say I made some changes
to the
object then I called the 'save' method of the new components default
editing
context - but the update to the database doesn't happen.
A
A component does not have a defaultEditingContext(), only the
session(). It sounds like you have done something else wrong.
Chuck
_______________________________________________
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.