• 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: Consistent reads
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Consistent reads


  • Subject: Re: Consistent reads
  • From: John Larson <email@hidden>
  • Date: Thu, 7 Dec 2006 05:48:37 -0600

Hi Miquel,

Funny, I just got done working through a similar problem myself. I'm a little short on time right now, but the gist of it is that I have objects register with a singleton directory in awake from fetch. I use a subclass of eogenericrecord to do that and index off the eoglobalid. I use a subclassed eoeditingcontext to modify the saveChanges method to detect when objects of the "shadowed" subclass are inserted or deleted. But then I can at any time I can get an NSArray of all the copies of an object in all the editing contexts. It's not elegant, but it works. Just be careful not to get your editing contexts confused. Lastly, it requires that you be aware of when you want to detect the inconsistencies. It's not "automatic."

I resorted to this method after scouring all the api's for days unable to come up with a prebaked solution.

John

On Dec 6, 2006, at 4:13 PM, Miguel Arroz wrote:

Hi!

I was having a small discussion about ORB mapping frameworks, and I found out something that I could not solve with WO, at least with the knowledge I have.

My question is, how can I make sure that, when I'm reading several objects from the DB, they are consistent with each other?

  Imagine I have:

  EOEditingContext context = new EOEditingContext();
  SomeEOObject object1 = readObject1(context);
  // comment
  SomeEOObject object2 = readObject2(context);

  NSLog.out.appendln(object1.someProperty());
  NSLog.out.appendln(object2.someProperty());

  context.dispose();

So, it's a read-only operation that displays values from data stored. My question is, how can I make sure that object1 and object2 are consistent between each other? There could be some other instance of the application modifying objects 1 and 2 right on my "comment" line. So, I'm reading object1 BEFORE that operation, and object2 AFTER that operation. Their values would not be consistent between each other.

As I never commit (because there's no changes) I cannot use optimistic locking to detect this inconsistence.

How do you solve this kind of problem? Locking the rows would not work, because I may have a more complex example where I can know what object2 is only after getting object1, so I would only lock object2 after fetching object1, and the problem would be the same.

  Yours

Miguel Arroz



"The world lies in the hands of evil
 And we pray it would last" -- Apocalyptica, Life Burns!

Miguel Arroz
http://www.ipragma.com




_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mac.com


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: 
 >Consistent reads (From: Miguel Arroz <email@hidden>)

  • Prev by Date: Re: MySQL 5.0.26 or 5.1.12 beta and WebObjects
  • Next by Date: ... has exited due to signal 10 (SIGBUS) ?
  • Previous by thread: Re: Consistent reads
  • Next by thread: Re: Xcode and WOUnitTest 2
  • Index(es):
    • Date
    • Thread