It seems im not clear enough.
Here I go again. 
Lets suppose I have a mapping like the following
(you may skip the mapping and see the small chart
 below):


<class-descriptor class="B" table="B">
  <field-descriptor
                    name="id"
                    column="B_id"
                    jdbc-type="INTEGER"
                    primarykey="true"
                    sequence-name="B_id_seq"
                    autoincrement="true"/>
  <field-descriptor
                    name="c"
                    column="c"
                    jdbc-type="CHAR"/>

</class-descriptor>


<class-descriptor class="D" table="D">
  <field-descriptor
                    name="id"
                    column="D_id"
                    jdbc-type="INTEGER"
                    primarykey="true"
                    sequence-name="D_id_seq"
                    autoincrement="true"/>
  <field-descriptor
                    name="e"
                    column="e"
                    jdbc-type="CHAR"/>
  <field-descriptor
                    name="f"
                    column="f"
                    jdbc-type="CHAR"/>

</class-descriptor>


<class-descriptor class="C" table="C">
  <field-descriptor
                    name="id"
                    column="C_id"
                    jdbc-type="INTEGER"
                    primarykey="true"
                    sequence-name="C_id_seq"
                    autoincrement="true"/>
  <field-descriptor
                    name="D_id"
                    column="D_id"
                    jdbc-type="INTEGER"/>

  <reference-descriptor
                        name="D"
                        class-ref="D"
                        auto-update="false"
                        auto-delete="false"
                        auto-retrieve="true">
                        <foreignkey field-ref="D_id"/>
  </reference-descriptor>

  <field-descriptor
                    name="d"
                    column="d"
                    jdbc-type="CHAR"/>
</class-descriptor>

<class-descriptor class="A" table="A">
  <field-descriptor
                    name="id"
                    column="A_id"
                    jdbc-type="INTEGER"
                    primarykey="true"
                    sequence-name="A_id_seq"
                    autoincrement="true"/>
  <field-descriptor
                    name="B_id"
                    column="B_id"
                    jdbc-type="INTEGER"/>

  <reference-descriptor
                        name="B"
                        class-ref="B"
                        auto-update="false"
                        auto-delete="false"
                        auto-retrieve="true">
                        <foreignkey field-ref="B_id"/>
  </reference-descriptor>
  <field-descriptor
                    name="C_id"
                    column="C_id"
                    jdbc-type="INTEGER"/>
  <reference-descriptor
                        name="C"
                        class-ref="C"
                        auto-update="false"
                        auto-delete="false"
                        auto-retrieve="true">
                        <foreignkey field-ref="C_id"/>
  </reference-descriptor>

  <field-descriptor
                    name="a"
                    column="a"
                    jdbc-type="CHAR"/>
  <field-descriptor
                    name="b"
                    column="b"
                    jdbc-type="CHAR"/>

</class-descriptor>

------------

Which I really think is easier to understand if you
look this chart

  B(c)     This means: A has a FK to B and C and A has properties a,b.
 /         B has property c.
A(a,b)     C has a FK to D and has property d.
 \         D has properties e and f.
  C(d)
   \
    D(e,f)

I am talking about the cases when you dont want the complete object.
I know that "select x from A" would bring me a DList with A Objects,
thats clear. My question is:
If I submit a query like this one:

"select x.C.D.e, x.B.c from A;"

Im not generating any already-defined objects so I was expecting to get
a DList of Object[] or something like that and I get a
org.apache.ojb.broker.util.collections.ManageableArrayList
not a DList anymore, why is that?


On Fri, 2004-07-02 at 19:49, Sukesh Garg wrote:
> check out the following link for the OJB ODMG API
> 
> http://db.apache.org/ojb/docu/tutorials/odmg-tutorial.html
> 
> The container is defined in the repository.xml file. 
> 
> http://db.apache.org/ojb/docu/tutorials/mapping-tutorial.html
> 
> 
> -A
> 
> On Fri, 2004-07-02 at 07:01, Martin I. Levi wrote:
> > Aren't you supposed to do something like:
> > 
> > select A.a, A.b, A.B.c, A.C.d, A.C.D.e, A.C.D.f from A,B,C,D;
> > 
> > ???
> > 
> > And THE BIG question is... when you perform an OQLQuery.execute() this
> > returns and Object what critery should I follow to choose the container
> > to store the resulting objects?
> > 
> > 
> > 
> > On Thu, 2004-07-01 at 19:49, Auckyboy wrote:
> > > 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
> > > > 
> > > > 
-- 
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]

Reply via email to