Re: Enumerating EOs in a new thread
Re: Enumerating EOs in a new thread
- Subject: Re: Enumerating EOs in a new thread
- From: Guido Neitzer <email@hidden>
- Date: Fri, 25 Jan 2008 10:29:31 -0700
On 25.01.2008, at 04:27, Paul Stringer wrote:
I've encountered this before when working with EO's in separate
threads, are there some rules to follow when doing so?
Yes, there are. Don't pass EOs between threads. ;-)
There are a couple of things to keep in mind:
- EOF will be blocked by your background thread as long as it's
running and not using its own object store coordinator.
- To pass enterprise objects over to a different object store
coordinator, you have to refault them.
- You still might do things in the wrong order and therefor perhaps
locking the wrong editing context or so.
My advice: pass an array of global ids or primary keys to the thread,
build the array of enterprise objects there inside a separate editing
context on a separate object store coordinator. Then you get your own
connection to the database and you're not blocking the rest.
If you are using Wonder: there are two methods in
ERXEOControlUtilities for getting an array of global ids from an array
of eos and vice versa.
Remember to close your database connection when you're done, and to
lock / unlock everything properly.
cug
--
Real-World WebObjects class at the Big Nerd Ranch
March 2008, Frankfurt, Germany
http://www.bignerdranch.com/classes/webobjects.shtml
_______________________________________________
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