Re: Fetching objects with relationship to an abstract entity does many db roundtrips
Re: Fetching objects with relationship to an abstract entity does many db roundtrips
- Subject: Re: Fetching objects with relationship to an abstract entity does many db roundtrips
- From: Mike Schrag <email@hidden>
- Date: Wed, 11 Nov 2009 09:26:03 -0500
EOF can't create faults for to-one relationships to abstract entities,
because a fault object has to be the correct java type, which requires
fetching the object to determine which restricting qualifier matches it.
ms
On Nov 11, 2009, at 8:16 AM, Sobanski, Jedrzej wrote:
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
_______________________________________________
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