Re: Fetch/saveChanges in Application Class
Re: Fetch/saveChanges in Application Class
- Subject: Re: Fetch/saveChanges in Application Class
- From: "Jerry W. Walker" <email@hidden>
- Date: Sun, 23 Dec 2007 18:50:34 -0500
Hi, Emmanuel,
I'm not sure what problem you're having with fetching from the
Application class, but the one that comes most immediately to mind is
that you don't have a default EOEditingContext in the Application
class like that provided by your Session class and usable from any of
your Session based WOComponents.
To solve that problem, just create your own but remember to lock it
before using it or any of the EOs associated with it and to unlock it
when you're done.
Typical code would look something like this:
EOEditingContext ec = new EOEditingContext();
try {
ec.lock();
EOFetchSpecification fs = new EOFetchSpecification
("myEntity", null, null);
NSArray myThings = ec.objectsWithFetchSpecification(fs);
...
// Do some things with myThings...
ec.saveChanges();
} finally {
ec.unlock();
}
Regards,
Jerry
On Dec 23, 2007, at 10:25 AM, Emmanuel KOPP wrote:
Hi,
I developping a game with WO.
How I can do a Fetch in Application Class and excecute a
saveChanges on this fetch in Application Class ?
an idea ??
Thanks
Manu
--
__ Jerry W. Walker,
WebObjects Developer/Instructor for High Performance Industrial
Strength Internet Enabled Systems
email@hidden
203 278-4085 office
_______________________________________________
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