You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Joose Vettenranta <jo...@iki.fi> on 2004/08/19 18:30:46 UTC

pbapi + select from multiple tables

I have like FOO and BAR classes and it's 1:n connection..

There can be lot's of FOO pointing to same BAR id

and BAR has parent id which points to BAR itself

now I would like to fetch something from that tree.. My first idea was 
this:

in SQL: select * from FOO,BAR where BAR.parent=<id> and 
BAR.id=FOO.bar_id;

but now that I was writing this, can I some how fetch the subtree from 
BAR? basicely BAR is a tree where there is 1 root element and then 
childs and their childs .. etc..

I tried to look at http://db.apache.org/ojb/docu/guides/query.html but 
couldn't find anything to help me.

of course one option could be to make a recursive function to go 
through whole tree, maybe it's what I have to do...

Thanks,

Joose

--
"Always remember that you are unique, just like everyone else!"
* http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: pbapi + select from multiple tables

Posted by Joose Vettenranta <jo...@iki.fi>.
Of course if I put that it's not auto-fetched. But how can I command it 
to fetch collection from object?

Collection col = bean.getCollection()

... then what?

- Joose

21.8.2004 kello 10:08, Joose Vettenranta kirjoitti:

  No, I don't... I could do it, but then I have a problem,
>
> how do I prevent it to load all of that info when fetching one?
>
> if I have BAR is like tree and FOO is just a list where 1 entry 
> belongs to one node. So if I have collection on auto-fetch and 
> reference as auto-fetch, then what ever I fetch from BAR or FOO, every 
> entry in BAR and FOO is fetched. Right?
>
> - Joose
>
> 20.8.2004 kello 15:12, Clóvis Wichoski kirjoitti:
>
>  Hi,
>>
>> in your BAR class you don't declare a collection for FOO, and a 
>> collection for BAR childs?
>>
>> Joose Vettenranta wrote:
>>
>>> I have like FOO and BAR classes and it's 1:n connection..
>>>
>>> There can be lot's of FOO pointing to same BAR id
>>>
>>> and BAR has parent id which points to BAR itself
>>>
>>> now I would like to fetch something from that tree.. My first idea 
>>> was this:
>>>
>>> in SQL: select * from FOO,BAR where BAR.parent=<id> and 
>>> BAR.id=FOO.bar_id;
>>>
>>> but now that I was writing this, can I some how fetch the subtree 
>>> from BAR? basicely BAR is a tree where there is 1 root element and 
>>> then childs and their childs .. etc..
>>>
>>> I tried to look at http://db.apache.org/ojb/docu/guides/query.html 
>>> but couldn't find anything to help me.
>>>
>>> of course one option could be to make a recursive function to go 
>>> through whole tree, maybe it's what I have to do...
>>>
>>> Thanks,
>>>
>>> Joose
>>>
>>> -- 
>>> "Always remember that you are unique, just like everyone else!"
>>> * http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
> --
> "Always remember that you are unique, just like everyone else!"
> * http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
--
"Always remember that you are unique, just like everyone else!"
* http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: pbapi + select from multiple tables

Posted by Joose Vettenranta <jo...@iki.fi>.
No, I don't... I could do it, but then I have a problem,

how do I prevent it to load all of that info when fetching one?

if I have BAR is like tree and FOO is just a list where 1 entry belongs 
to one node. So if I have collection on auto-fetch and reference as 
auto-fetch, then what ever I fetch from BAR or FOO, every entry in BAR 
and FOO is fetched. Right?

- Joose

20.8.2004 kello 15:12, Clóvis Wichoski kirjoitti:

  Hi,
>
> in your BAR class you don't declare a collection for FOO, and a 
> collection for BAR childs?
>
> Joose Vettenranta wrote:
>
>> I have like FOO and BAR classes and it's 1:n connection..
>>
>> There can be lot's of FOO pointing to same BAR id
>>
>> and BAR has parent id which points to BAR itself
>>
>> now I would like to fetch something from that tree.. My first idea 
>> was this:
>>
>> in SQL: select * from FOO,BAR where BAR.parent=<id> and 
>> BAR.id=FOO.bar_id;
>>
>> but now that I was writing this, can I some how fetch the subtree 
>> from BAR? basicely BAR is a tree where there is 1 root element and 
>> then childs and their childs .. etc..
>>
>> I tried to look at http://db.apache.org/ojb/docu/guides/query.html 
>> but couldn't find anything to help me.
>>
>> of course one option could be to make a recursive function to go 
>> through whole tree, maybe it's what I have to do...
>>
>> Thanks,
>>
>> Joose
>>
>> -- 
>> "Always remember that you are unique, just like everyone else!"
>> * http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
--
"Always remember that you are unique, just like everyone else!"
* http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: pbapi + select from multiple tables

Posted by Clóvis Wichoski <cl...@uol.com.br>.
Hi,

in your BAR class you don't declare a collection for FOO, and a 
collection for BAR childs?

Joose Vettenranta wrote:

> I have like FOO and BAR classes and it's 1:n connection..
>
> There can be lot's of FOO pointing to same BAR id
>
> and BAR has parent id which points to BAR itself
>
> now I would like to fetch something from that tree.. My first idea was 
> this:
>
> in SQL: select * from FOO,BAR where BAR.parent=<id> and 
> BAR.id=FOO.bar_id;
>
> but now that I was writing this, can I some how fetch the subtree from 
> BAR? basicely BAR is a tree where there is 1 root element and then 
> childs and their childs .. etc..
>
> I tried to look at http://db.apache.org/ojb/docu/guides/query.html but 
> couldn't find anything to help me.
>
> of course one option could be to make a recursive function to go 
> through whole tree, maybe it's what I have to do...
>
> Thanks,
>
> Joose
>
> -- 
> "Always remember that you are unique, just like everyone else!"
> * http://iki.fi/joose/ * joose@iki.fi * +358 44 561 0270 *
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org