Fetching objects with relationship to an abstract entity does many db roundtrips
Fetching objects with relationship to an abstract entity does many db roundtrips
- Subject: Fetching objects with relationship to an abstract entity does many db roundtrips
- From: "Sobanski, Jedrzej" <email@hidden>
- Date: Wed, 11 Nov 2009 14:16:30 +0100
- Acceptlanguage: en-US
- Thread-topic: Fetching objects with relationship to an abstract entity does many db roundtrips
Hi,
I have a performance issue when it comes to initializing object having
relationship referring to abstract entity. My model is like:
- non-abstract entity "Referring" which foreign key "referredId" and
relationship on it, pointing to Referred.referredId
- abstract entity "Referred" with primary key "referredId" and a field
named "type"
- non-abstract entity "ReferredA" extending "Referred". There's type
qualifier on field "type"
- non-abstract entity "ReferredB" extending "Referred". There's type
qualifier on field "type"
- non-abstract entity "ReferredC" extending "Referred". There's type
qualifier on field "type"
When I fetch a bunch of Referring (let's say 70 rows) then I see in
logs "70 row(s) processed" but right after it in logs, while still in
the same EOEditingContext#objectsWithFetchSpecification
(EOFetchSpecification), it does 70 more fetches, where each of them is
like:
"... expression took XX ms: SELECT ... FROM Referred WHERE ... AND
referredId = <some concrete id>
fetch cancelled
1 row(s) processed"
So in total it does 71 database roundtrips. It looks like it fetches
full objects for Referring.referred relationship instead of just
creating fault. I believe it's because relationship points to abstract
entity and having only referredId from Referring, still doesn't
specify final entity for target object. So I think what EOF does it
fetches full target object, to check value for field "type" to fully
determine target entity.
Do you know if and how can I avoid this resource consuming routine?
--
Regards,
Jedrzej Sobanski
_______________________________________________
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