I'll take a stab at it.

when performing OQL queries using OJB, you get back the complete object
A with references to B, C and further objects if they exist otherwise
they are null.

Assuming you have the following objects..

A{
B b;
int bId;
C c;
int cId;
}

and 

C{
D d;
int dId;
}


D{
 id;
 name;
}
Now you want A where B, C and D are defined...

select a from A where bID != 0 and cId!=0 and c.dId!=0

this in effect would give you A where B,C and D are defined.

However, as a suggestion, if you need to perform queries on A, B, C
etc..its better to use...

select a from A where c.d.name = "somename" 


HTH
-A

On Thu, 2004-07-01 at 10:19, Martin I. Levi wrote:
> Hi!
> 
> Well, here I am with the ODMG 3.0 book trying to perform OQL querys
> through OJB but I really think I just dont get it. 
> Lets suppose I have a table A with FK to B and C where C has a FK to D
> Something like this:
>   B
>  /
> A
>  \
>   C
>    \
>     D
> 
> Which are mapped to the objects A, B, C and D.
> Now I want to perform a query which in SQL would be:
> 
> SELECT A.a, A.b, B.c, C.d, D.e, D.f 
> FROM A,B,C,D
> WHERE A.B_key = B.B_key
> AND   A.C_key = C.C_key
> AND   C.D_key = D.D_key
> ;
> 
> My questions are...
> 1) how could I do this on an OQL query through OJB?
> 2) which kind of container should I use to store the result? An
> ArrayList does always do the trick?, I suppose it doesn't...
> 
> Any help will be useful!
> 
> -- 
> Saludos,
> 
> Martin I. Levi
> 
> Centre TecnolÃgic de TransferenciÃncia de Calor
> Universitat PolitÃcnica de Catalunya
> www.cttc.upc.edu
> 
> 
> ---------------------------------------------------------------------
> 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