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: David LeBer <email@hidden>
- Date: Sun, 6 Jan 2008 23:37:45 -0500
On 6-Jan-08, at 10:25 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
Exactly... What Guido said.
By the way, Project Wonder makes using extra ECs particularly painless
with it's EC autolocking and ERXEC factory.
<http://davidleber.net/?p=282>
;david
--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site: http://codeferous.com
blog: http://davidleber.net
profile: http://www.linkedin.com/in/davidleber
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org
_______________________________________________
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