• 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: Weird problem with setPrefetchingRelationshipKeyPaths
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird problem with setPrefetchingRelationshipKeyPaths


  • Subject: Re: Weird problem with setPrefetchingRelationshipKeyPaths
  • From: Jake MacMullin <email@hidden>
  • Date: Mon, 17 Mar 2008 08:18:26 +1100

Miguel,

Perhaps you've also specified that the fetch specification you're using should refresh re-fetched objects? If so - it will also refresh any relationships you've asked it to pre-fetch.

From the EOFetchSpecification javadoc:

"Assigning relationships to prefetch also has an effect on how a fetch specification refreshes.
Refreshing refers to existing objects being overwritten with fetched values. This allows the application to see changes to the database that have been made by someone else. Normally, when an EOFetchSpecification is set to refresh using setRefreshesRefetchedObjects, it only refreshes the objects you are fetching. For example, if you fetch employees, you do not also fetch the employees' departments. However, if you prefetch relationships, the refetch is propagated for all of the relationships specified."


Cheers,

Jake


On 17/03/2008, at 5:32 AM, Miguel Arroz wrote:

Hi!

I have an entity A where each object contains some references to other objects in entity B (each A contains some Bs, but each B is on a diferente relation). The relations are one-to-one, and are modeled only from A to B.

I'm fetching some objects from entity A, and I'm using setPrefetchingRelationshipKeyPaths to pre-fetch the Bs. I'm passing in an array with all the relationship keys I want to grab.

I run this, and it looks like it's going to work. The A SELECT query is done, and then some SELECT DISTINCT queries are done on the B table, fetching the related B objects. I copied one of those querie from the log to the DB console and run it, and it does in fact select the objects that it's supposed to.

So far, looks good. The problem is that when I later iterate among the fetched A objects and start to access Bs, the Bs are all fetched again, each one in it's roundtrip.

I fired up the debugger, and something really strange happens. After all those queries being done, I peek inside an A object, and find that Bs are not being placed in As. IE, all the relationship to Bs are still faults, not real data.

So, EOF is fetching the objects, but it's not inserting them on the graph... why?

Yours

Miguel Arroz

Miguel Arroz
http://www.terminalapp.net
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:
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: 
 >Weird problem with setPrefetchingRelationshipKeyPaths (From: Miguel Arroz <email@hidden>)

  • Prev by Date: Weird problem with setPrefetchingRelationshipKeyPaths
  • Next by Date: Changing image onMouseOver of WOHyperLink
  • Previous by thread: Weird problem with setPrefetchingRelationshipKeyPaths
  • Next by thread: Re: Weird problem with setPrefetchingRelationshipKeyPaths
  • Index(es):
    • Date
    • Thread