Sebastian Escribio :-)
> Hi Armin,
>
> the filter attribute is not static. I was hoping that I can setup a
> query criteria like below, but currently there is no criteria method
> that fits.
>
> parent = <retrieve somehow via pb>
> crit = new Criteria();
> crit.addIs("parent", parent);
> crit.addEqualTo("ref", "blablabla");
Hi,
try this:
crit = new Criteria();
crit.addEqualTo("childList.ref", "blablabla");
query = new QueryByCriteria(Parent.class,crit);
when childList is a collection of Child class in the Parent Class.
Cheers,
Carlos Ch�vez.
> query = new QueryByCriteria(Child.class,crit);
> ...
>
> Here are the classes again:
> ===========================
> class Child {
> private Parent parent;
> private String ref;
> }
>
> class Parent {}
>
>
> Armin Waibel wrote:
>
>> Hi Sebastian,
>>
>> if the "one particular Child object" is based on information of the
>> parent object or the filter attributes are static you can try to use
>> custom collection queries
>>
>> http://db.apache.org/ojb/tutorial3.html#Customizing%20collection%20queries
>>
>> > Btw. OJB is configured to use a foreign key with anonymous access to
>> > reference the Parent object.
>>
>> please be careful in using anonymous keys outside of a 1:1 reference.
>> Here is the section in new upcoming documentation (beta-version)
>>
>> http://www.powaibel.de/ojb/ojb-style/docu/advanced-technique.html#How+do+
>>
>> regards,
>> Armin
>>
>>
>> Sebastian wrote:
>>
>>> I have the following 2 classes:
>>>
>>> class Child
>>> {
>>> private Parent P;
>>> private String ref;
>>> }
>>>
>>> class Parent
>>> {
>>>
>>> }
>>>
>>> [Child] n<-1 [Parent]
>>>
>>> Now somehow I retrieve an object of Parent and want to get the
>>> corresponding Child object with a certain value in the ref field.
>>>
>>> I know that I could create a reference collection property in the
>>> repository file for class Parent. I want to avoid this to save memory
>>> and db calls since I'm only interested in one particular Child object
>>> and not in all Child objects that belong to Parent.
>>>
>>> How can I do this?
>>>
>>> Btw. OJB is configured to use a foreign key with anonymous access to
>>> reference the Parent object.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
Carlos Ch�vez
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]