question about flattened to-many relationships
question about flattened to-many relationships
- Subject: question about flattened to-many relationships
- From: Boris Herman <email@hidden>
- Date: Fri, 11 Nov 2005 19:59:02 +0100
Hi list,
here is what I have:
a Company entity with attributes such as company address, tax id,
bank info etc
a ContactPerson entity with person name, phone, email etc
Quite obviously this is a to-many situation as one Company can have
many ContactPersons, so I created a CompanyPersons entity with only
two attributes CompanyID and ContactPersonID which are both key
fields. Then I have set up a one-way to-many relationship from
Company to CompanyPersons and a to-one one-way relationship from
CompanyPersons to ContactPerson. Then I flattened the relationship to
have CompanyPersons relationship available as an attribute in
Company. So far so good.
I created a search/browse WOComponent, put a DisplayGroup on it, a
couple of search fields (bound to respective QueryMatch) and below a
WORepetition that displays the results in a table, one Company per
row (it's companies we're searching). In one table cell I have put
another WORepetition which scans the CompanyPersons flattened
relationship and displays the contents of the list in that single
cell, one row per Person. Also, one of the search textfields is bound
to DisplayGroup.queryMatch.Company_Persons.name which is a
subattribute of the flattened relationship and this setup actually
works like a charm. However, when I filled the database with a
portion of real data (10.000 customers and 10.000 persons) it takes
quite a while on first search - about 15 seconds on an 1 GHz XServe.
SQL debug shows that it is actually fetches all Companies and all
Persons in the memory (as was mentioned in every WO book I read and
I've read them all). After it has cached the data in memory the
subsequent searches are fast (about 2 seconds).
Wasn't EOF supposed to instead of actual relationship EO objects
create faults and fetch the data only when needed and only those
which are needed?
What am I to do to speed this up? How will I handle the whole set of
real data (about 20 times more on this two entities, more than 2 mio
records on parts that I haven't even begun to work on)
Am I doing the whole thing wrong?
Comments and suggestions are most welcome,
Boris Herman
_______________________________________________
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