• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: EOEditingContext problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EOEditingContext problem


  • Subject: Re: EOEditingContext problem
  • From: David Avendasora <email@hidden>
  • Date: Wed, 18 Mar 2009 06:05:22 -0400


On Mar 18, 2009, at 4:09 AM, .::welemski::. wrote:

Hi Lists,


First of all I would like to apologize if this message appears on the list twice as I have problem sending it from my email gateway.

Here's my problem:

I have an Entity called EInstitution with a string attribute named
xmlData. This xmlData holds an xml encoded using WOXMLCoder. xmlData
attribute holds all the information about images like height, width,
etc. etc. I have a two applications that uses this entity.
Application1 is where you you add images and descriptions.
Application2 is where you displays all images, contents etc using
DirectAction classes. The weird thing is that, when I made changes to
the images attributes like height and width and call saveChanges()
method it actually saves to the database however if I'm going to
access Application2 and get that new height and width it never detects
that changes made by Application1. Application2 can only get the new
changes if I'm going to stop the session and run the session again
using WOMonitor.

What am I doing wrong?

You are running into EOF's cache. It doesn't always go back to the database. You can force it though.


In Application2, if you always want to be absolutely sure that you are getting the latest changes from the database, you'll need to call editingContext().refreshObject(myObject); which will cause EOF to go back to the database and get myObject again. You can also force the editingContext() to refreshAllObjects() too, but that is pretty heavy handed.

You should make sure you understand the concepts outlined here:

http://developer.apple.com/documentation/webobjects/Enterprise_Objects/Fetching/Fetching.html and scroll down to the section labled "Ensuring Fresh Data".

Also, Chuck Hill and Sacha Mallais's book Practical WebObjects has a chapter on Managing the Object Graph which includes specific ways to manage object freshness.

Dave


Btw, I created a class called CoreClass(String institutionName, EOEditingContext aContext) with a method getInstitution that returns EInstitution. And i put this class on a framework where Application1 and Application2 can access.

Regards,

•••••••••••••••••••••••••••••••••••••••
 Lemuel Raganas
 email@hidden
_______________________________________________
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



_______________________________________________ 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
References: 
 >EOEditingContext problem (From: ".::welemski::." <email@hidden>)

  • Prev by Date: Re: EOEditingContext problem
  • Next by Date: Re: EOEditingContext problem
  • Previous by thread: Re: EOEditingContext problem
  • Next by thread: Re: EOEditingContext problem
  • Index(es):
    • Date
    • Thread