hi mark,

prefetching currently works only for one level . the prefetcher looks for a relationship named

"allb.singlec" in A.class in your sample.  the query criteria has no effect on 
prefetching.
i'm not sure whether deep prefetching is really useful. in your sample deep 
prefetching would return all Bs including all Cs for the Bs.

hth
jakob



Mark Rowell wrote:

Hi

Does anyone know if prefetched relationships can reach more than one "layer"
of references/collections from an class being queried?
E.g. If I have a class A that I an querying and it has a 1:m relationship
with some class B, with the relationship defined by the name "allb",
and then each B has 1 1:1 relationsbip with another class C, with the
relationship called "singlec", is the following supposed to work:

        Criteria criteria = new Criteria();
     // configure the criteria
     ...

     // add prefetched relationships
        criteria.addPrefetchedRelationship("allb");
        criteria.addPrefetchedRelationship("allb.singlec");

Query q = QueryFactory.newQuery( A.class, criteria);

I can get the single layer if indirection (e.g.
criteria.addPrefetchedRelationship("allb")) to work, but when I try the
above I get
an error message from OJB saying that it cant find the relationship
"allb.singlec". One thing to not is that I can specify query criteria
on this 2 level relationship i.e.

criteria.addEqualTo("allb.singlec.somefield", "test value");

where somefield is a field in the class C.

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]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to