Re: What's a good way to handle orders?
Re: What's a good way to handle orders?
- Subject: Re: What's a good way to handle orders?
- From: Kevin Windham <email@hidden>
- Date: Wed, 9 Jan 2008 21:37:04 -0600
On Jan 6, 2008, at 9:23 PM, Guido Neitzer wrote:
On 06.01.2008, at 19:38, Kevin Windham wrote:
The way I understand it, the order may not be in the DB, but it
does interact with the other objects that are since it is part of
the object graph in memory. One case I saw was looking at order
history. The order wasn't in the DB, but when you go look at the
order history you can see the bogus order there. There are other
things that might be affected, the problem for me with going that
route is I don't know how exactly it works under the hood. I'm
just worried there would be other side effects that I don't know
about.
Use a different editingContext then the defaultEditingContext of
the session for your order, as you should always do. Make all your
changes there and save it only at the end.
If your user stops the checkout process implicitly, you can call
editingContext.revert() and then just discard it. Or you can leave
it hanging around. As long as you don't call saveChanges, nothing
gets pushed to the other editingContexts.
You can look at an editingContext as a sandbox where you can play
in until you have things in a state you want - if you want to tell
the rest of the application about the changes, save them. If not,
just discard that editingContext and you're done.
You can read more about that here:
http://developer.apple.com/documentation/WebObjects/
Enterprise_Objects/Managing/chapter_7_section_1.html
This seems to work quite well. It wasn't quite as easy as it sounded
though. I had some interesting errors at first until I read a bit and
found out that you have to copy all the objects you want to use into
the new EC. My initial attempts at that were failures as well. The
documentation was a little confusing, but I found a web page that
explained how to copy objects into other ECs. <http://
developer.apple.com/documentation/WebObjects/Reference/WO53_Reference/
com/webobjects/eocontrol/concepts/EOEditingContextConcepts.html>
Now things seem pretty straightforward.
Thanks a bunch,
Kevin
_______________________________________________
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