Hi
I had a problem with prefetched relationships for collections, where the
owner of a collection in a relationship is a class that is part of an
extent.
It manifested itself by when I tried to access the collection in an owner it
always had size of zero. I tracked down the problem to CollectionPrefetcher
where
it gets the owner by identity using the foreign key in the item class in the
collection. It was creating an instance of Identity using the real
class of the object whereas in RsIterator the owner instance is cached using
the top level class in the extent (as the primary keys must be unique across
all concrete classes in
an extent). Hence I change CollectionPrefetcher thus in the
associatedBatched method of CollectionPrefetcher:
Existing line of code
id = new Identity(getOwnerClassDescriptor().getClassOfObject(),
fkValues);
Change it to
id = new Identity(
getBroker().getTopLevelClass(getOwnerClassDescriptor().getClassOfObject()),
fkValues );
and collection prefetch should work for all types of owner both concrete and
part of an extent. I havent checked the 1:1 relationship prefetcher.
As a side not this analysis could have remifications for other places in the
code where a new Identity() instance is created.
Regards,
Mark Rowell
----------------------------------------------------------------
Mark Rowell
CreditTrade
T: +44 (020) 7400 5078
M: mailto:[EMAIL PROTECTED]
CreditTrade Limited is regulated by the FSA. (c) CreditTrade 2002. All rights
reserved. The information and data contained in this email is provided for the
information purposes of the addressee only and should not be reproduced and/or
distributed to any other person. It is provided without any warranty whatsoever and
unless stated otherwise consists purely of indicative market prices and other
information.
Any opinion or comments expressed or assumption made in association with the data or
information provided in this email is a reflection of CreditTrades judgement at the
time of compiling the data and is subject to change. CreditTrade hereby makes no
representation and accepts no responsibility or liability as to the completeness or
accuracy of this email.
The content of this email is not intended as an offer or solicitation for, or
recommendation of, the purchase or sale of any financial instrument, or as an official
confirmation of any transaction, and should not be construed as investment advice.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]