RE: how to get fresh data from backend?
RE: how to get fresh data from backend?
- Subject: RE: how to get fresh data from backend?
- From: <email@hidden>
- Date: Wed, 23 Mar 2005 17:59:21 +0100
- Thread-topic: how to get fresh data from backend?
Hi!
Data freshness is a hot and complex topic that has repeatedly been discussed here in great length.
In your case, for starters, a simple fetchSpec.setRefreshesFetchedObjects() might be sufficient.
If the objects have relationships for which data might go stale things get hairy. You could help yourself with pre-fetching keypaths.
My favorite solution would be to have a temporary editing context on which you setFetchTimestamp(System.currentTimeMillis()). The catch is that you will have to handle the locking/unlocking of the context on your own. For this you need to determine the uses of the EOs fetched into that context.
Pierre
-----Original Message-----
From: webobjects-dev-bounces+pierre.bernard=email@hidden
[mailto:webobjects-dev-bounces+pierre.bernard=email@hidden]On
Behalf Of Theodore Petrosky
Sent: Wednesday, March 23, 2005 5:50 PM
To: email@hidden
Subject: how to get fresh data from backend?
I have a WO component that displays the results of a
query. The database could be updated from either my WO
component OR from my cocoa app. It appears as if WO is
caching the results and not getting new data when I
display a component.
What I want to do is to refresh my data every time the
page is displayed. But now, if I display the list,
then someone updates the database from my cococa app,
even a new connection to the web page will result in
the stale data.
My component is very simple....
public class EmployeeListComponent extends WOComponent
{
public NSArray employeeListArray;
public Employeedata aRowFromEmployeeList;
public EmployeeListComponent(WOContext context) {
super(context);
}
public void appendToResponse (WOResponse response,
WOContext context) {
EOFetchSpecification fetchSpec =
EOFetchSpecification.fetchSpecificationNamed("onlyCurrent",
"Employeedata");
EOEditingContext ec =
session().defaultEditingContext();
employeeListArray =
ec.objectsWithFetchSpecification(fetchSpec);
super.appendToResponse(response, context);
}
public Main returnToMainMenu()
{
Main nextPage = (Main)pageWithName("Main");
return nextPage;
}
}
Thanks,
please be gentle, I am new to WO..
Ted
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/
_______________________________________________
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
**********************************************************************
This email and any files transmitted with it are intended solely for
the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the sender
of this message. (email@hidden)
This email message has been checked for the presence of computer
viruses; however this protection does not ensure this message is
virus free.
Banque centrale du Luxembourg; Tel ++352-4774-1; http://www.bcl.lu
**********************************************************************
_______________________________________________
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