Excellent! that's right.
Thanks for your help
Gildas
----- Original Message -----
From: "Maksimenko Alexander" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, October 27, 2004 4:27 PM
Subject: Re: collection loading and filtering
query.setObjectProjectionAttribute("elements")
will solve your problem
>Hi Alexander,
>
>I tried your suggestion. With the "addPrefetchedRelationship()"method all
>elements of the relationship are loaded. The filter criteria, here, is a
>condition to retrieve the A object. In fact it's the right behaviour for
>this request.
>
>The problem is to realize a kind of left outer join in OOP to get the
>Collection of B which belong to A.
>
>In fact I use the A data to find some B elements. Now I think to load a
>filtered relationship is not very good idea.
>
>As a last resort I can use the sqlStatement but I loose the transparency of
>the persistence.
>
>Thanks
>
>Gildas
>
>----- Original Message -----
>From: "Maksimenko Alexander" <[EMAIL PROTECTED]>
>To: "OJB Users List" <[EMAIL PROTECTED]>
>Sent: Wednesday, October 27, 2004 2:25 PM
>Subject: Re: collection loading and filtering
>
>
>did you try query.addPrefetchedRelationship("elements") ?
>
>
>
>>Hi all,
>>
>>I have un object A referencing � collection with B elements.
>>
>>A has an attribute 'name' and a relation 'elements', B has an attribute
>>'filter'.
>>
>>I want to load elements where name='xxx' and filter='yyy'.
>>
>>I use the PersitenceBroker API, here is my request:
>>
>> criteria = new Criteria();
>>
>> criteria.addEqualTo("name", 'xxx');
>> criteria.addEqualTo("elements.filter", 'yyy');
>>
>> query = QueryFactory.newQuery(A.class, criteria);
>>
>> A a = (A)broker.getObjectByQuery(query);
>>
>>With the relationship auto-retrieve=true all elements are loaded!
>>
>>If auto-retrieve=false the relationship is not loaded.
>>
>>Is there a solution ?
>>
>>
>>Thanks
>>
>>Gildas
>>
>>---------------------------------------------------------------------
>>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]
>
>---------------------------------------------------------------------
>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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]