Re: Newbie FetchSpecification
Re: Newbie FetchSpecification
- Subject: Re: Newbie FetchSpecification
- From: Art Isbell <email@hidden>
- Date: Sat, 15 Mar 2003 10:03:26 -1000
On Friday, March 14, 2003, at 10:29 AM, Serge Smadja wrote:
I've written my first WO program. It fetches one entity called "Site"
from a database based on parameters passed from a WOForm. The trouble
is when a SITE column value is modified in the database ie through a
DirectToWeb app, the page doesn't reflect the changes as if the
database was queried only once. What's happening ? What should I do to
make the Db fetch every time a changes occurs.
DB servers don't generally have a mechanism for notifying all DB
clients when a change has occurred within the DB server. So a DB
client isn't going to be aware of any change until it accesses the DB
server.
If a WO process fetches an object, that object is changed in the DB
server by another process, and the WO client refetches the same object,
the changes are discarded by default so the change won't be seen!
While this may seem surprising at first, it makes sense that you might
not want to update an object that may be in the process of being
updated on the client. Remember that in a WO process, multiple users
(i.e., sessions) may be accessing the same object simultaneously. If
one session refetches an object that another session may be updating,
you may not want to suddenly update this object on the client.
You can modify this behavior by setting a fetch specification to
refresh refetched objects. In your code:
EOFetchSpecification fetchSpec = new
EOFetchSpecification("Site", qualifier,
null).setRefreshesRefetchedObjects(true);
Aloha,
Art
_______________________________________________
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.