Re: Weird problem with setPrefetchingRelationshipKeyPaths
Re: Weird problem with setPrefetchingRelationshipKeyPaths
- Subject: Re: Weird problem with setPrefetchingRelationshipKeyPaths
- From: Chuck Hill <email@hidden>
- Date: Mon, 17 Mar 2008 09:59:52 -0700
HI Miguel,
On Mar 16, 2008, at 11:32 AM, Miguel Arroz wrote:
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.
That last part _might_ be the problem.
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?
I don't know. But I recently noticed that one place in the project I
am working on has the same problem. It is on my list to investigate.
If you figure it out, us know.
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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