I have a Party superclass and Person/Organisation sub classes. I have
relationships set up at both levels. If I create a query based on person and
prefetch a Person specific relationship, then I get two selects - one for
the person(s) and one for the relationship for those person(s). All is well
:-)
However, if I prefetch one of the Party relationships (regardless of it
being a Party or Person based query), then I get more than two selects - one
for the person(s), one for the relationship for those person(s), and then
one for each party related to a relationship (fetching the "Party" object
by its id). It looks like that if I use a party relationship, then it
executes a search for every distinct "toParty" link pointing back from the
relationship record(s) to party. Is this is a bug or a feature? I would
rather not have to push all my relationships to the leaf classes if I can
help it.
Thanks
Derek
BTW: environment is RC1, Win XP and DB2 8.1
Here is a summary of the output:
INFO QueryLogger: SELECT DISTINCT t0.SURNAME_UPPER, t0.FIRST_NAME_UPPER,
t0.PARTY_ID FROM DBA.PARTY t0 WHERE t0.SURNAME_UPPER LIKE CAST (? AS
VARCHAR(100)) [bind: 'ABC%'] - prepared in 10 ms.
INFO QueryLogger: === returned 4 rows. - took 171 ms.
INFO QueryLogger: SELECT t0.BALANCE, t0.PARTY_REL_ID, t0.PARTY_ID FROM
DBA.PARTYREL t0, DBA.PARTY t1 WHERE t0.PARTY_ID = t1.PARTY_ID AND
(t1.SURNAME_UPPER LIKE CAST (? AS VARCHAR(100))) [bind: 'ABC%']
INFO QueryLogger: === returned 4 rows. - took 30 ms.
INFO QueryLogger: +++ transaction committed.
INFO QueryLogger: --- will run 1 query.
INFO QueryLogger: --- transaction started.
INFO QueryLogger: SELECT t0.SURNAME_UPPER, t0.FIRST_NAME_UPPER, t0.PARTY_ID
FROM DBA.PARTY t0 WHERE t0.PARTY_ID = ? [bind: 787391]
INFO QueryLogger: === returned 1 row. - took 40 ms.
INFO QueryLogger: +++ transaction committed.
INFO QueryLogger: --- will run 1 query.
INFO QueryLogger: --- transaction started.
INFO QueryLogger: SELECT t0.SURNAME_UPPER, t0.FIRST_NAME_UPPER, t0.PARTY_ID
FROM DBA.PARTY t0 WHERE t0.PARTY_ID = ? [bind: 787421]
INFO QueryLogger: === returned 1 row. - took 30 ms.
INFO QueryLogger: +++ transaction committed.
INFO QueryLogger: --- will run 1 query.
INFO QueryLogger: --- transaction started.
INFO QueryLogger: t0.SURNAME_UPPER, t0.FIRST_NAME_UPPER, t0.PARTY_ID FROM
DBA.PARTY t0 WHERE t0.PARTY_ID = ? [bind: 787402]
This archive was generated by hypermail 2.0.0 : Wed Oct 20 2004 - 20:34:39 EDT