Re: ERXEOControlUtilities.objectsInRange and prefetching brainstorm
Re: ERXEOControlUtilities.objectsInRange and prefetching brainstorm
- Subject: Re: ERXEOControlUtilities.objectsInRange and prefetching brainstorm
- From: Chuck Hill <email@hidden>
- Date: Wed, 30 Jul 2008 08:19:53 -0700
On Jul 30, 2008, at 4:39 AM, Miguel Arroz wrote:
Hi!
One of our paged table controllers is based on the
ERXEOControlUtilities.objectsInRange method. This works fine, but
has a drawback, prefetching is not correctly supported for the fetch
specification used.
The problem is that the "main" query has the DESC LIMIT X OFFSET Y
at the end, but the queries for prefetching don't have any kind of
limitation (which is normal, the same values can't be applied to
them) so they pre-fetch for all the objects that would have been
pulled by the main spec if there was no range. Which, naturally, may
be too much information to be handled efficiently.
I noticed that the prefetching queries are made using a JOIN
between the pre-fetched entity and the conditions for fetching the
main spec entity. One way this could be solved would be to change
the way pre-fetching queries are made to use the primary keys of the
values fetched in the main query. It could be as simple as SELECT *
FROM pre-fetched-entity WHERE main_entity_id IN (1, 2, 3, 4, ... ).
Also, I still have the problem of not being able to pre-fetch one-
to-one relationships. Yes, I know WO doesn't support one-to-one,
It doesn't?
but they are handy many times. And this is clearly a bug, because
the query - the correct query! - is made, but apparently the objects
are not integrated in the object graph.
I am not understanding this last bit.
What I'm going to do to simulate the pre-fetching is several fetch
specs that pull all the stuff I need in the minimum number of
roundtrips as possible. But how hard do you think this would be to
solve in WO or Wonder? Sorry for disturbing you guys from MobileMe
and SproutsCore integration and all that funny stuff. :)
Already done. See ERXBatchFetchUtilities (formerly known as
ERXRecursiveBatchFetching).
Chuck
--
Chuck Hill Senior Consultant / VP Development
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