Re: refreshing the defaultEditingContext

Robert Walker <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
I wanna make sure I understand this correctly.  You were originally  
using the session().defaultEditingContext() to fetch data for your  
RSS feed.  I am assuming you are accessing the RSS feed from a direct  
action, so when accessing session() you are getting an unneeded  
session for each request.

You then decided to use the defaultSharedEditingContext in place of  
the session().defaultEditingContext() to prevent the creation of a  
new session.

If this is accurate them my first question would be: Why did you not  
create a new instance of EOEditingContext and use that instead of  
session().defaultEditingContext()?  This will prevent creating a new  
session for each request and will not have the issues related to the  
shared editing context.

You should also examine the documentation on "Fetching Data >  
Ensuring Fresh Data" in this document:

http://developer.apple.com/documentation/WebObjects/ 
Enterprise_Objects/index.html

Example:

	public WOActionResults myRSSFeedAction() {
		EOEditingContext ec = new EOEditingContext();

		ec.lock();

		/* Fetch your data and generate RSS feed here */

		ec.unlock();
	}


On May 15, 2006, at 2:57 PM, Dev WO wrote:

> Hi guys,
> I've been trying to optimize my application a little as I had some  
> RSS feed which was actually creating a session and finally as RSS  
> readers update themselves every x minutes, I just couldn't softly  
> restart the instance.
> So I moved the RSS component using the defaultSharedEditingContext,  
> making sure no session was created. So this part was ok so far.
> But trying it I saw that the data from the  
> defaultSharedEditingContext didn't update...
> I can afford some delay for the update like minutes, but it's been  
> 5 hours now:(
>
> How should I make the sharedEC to update itself? The data are being  
> edited/added using another WOApplication, so maybe the other  
> application could "call" the sharedEC to make it refresh...
>
> Or do:
> setRefreshesRefetchedObjects(true);
> on the fetch specification should work?
>
> Thanks a lot for any tip:)
>
> Xavier

_______________________________________________
WebObjects-dev mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/webobjects-dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.