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 "Martin I. Levi" <ml...@labtie.mmt.upc.es> on 2004/07/08 13:42:13 UTC

OQL Queries returning collections (second try)

Hi!

As i didn't have an answer to my last mail 
im writing again.

Lets suppose I have a mapping like the following:


  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)

If I submit an OQL query like this:

"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 org.odmg.DList anymore, why is that?
what are this Manageable* containers for?
Are implemented any kind of queries which return DBags, DSets or DMaps?

-- 
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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OQL Queries returning collections (second try)

Posted by "Martin I. Levi" <ml...@labtie.mmt.upc.es>.
Just in case im working with rc 7.

On Fri, 2004-07-09 at 12:34, Martin I. Levi wrote:
> Well I think this is what you are talking about:
> 
> #----------------------------------------------------------------------------------------
> # OQL / SQL settings
> #----------------------------------------------------------------------------------------
> # The OqlCollectionClass entry defines the collection type returned
> # from OQL queries. By default this value is set to DListImpl.
> # This will be good for most situations as DList allows maximum flexibility
> # in a ODMG environment. See also section 'ODMG settings'.
> # Using DLists for large resultsets may be bad for application performance.
> # For these scenarios you can use ArrayLists or Vectors.
> # Important note: the collections class to be used MUST implement the
> # interface org.apache.ojb.broker.ManageableCollection.
> #
> OqlCollectionClass=org.apache.ojb.odmg.collections.DListImpl_2
> # OqlCollectionClass=org.apache.ojb.broker.util.collections.ManageableArrayList
> # OqlCollectionClass=org.apache.ojb.broker.util.ManageableVector
> #
> 
> 
> What happens here is that I get DListImpl_2 when I execute the typical
> OQL query:   select myniceObjects from A.getClass().getName();
> but when I ask for an embedded property, I mean something like:
> select x.B.c from A.getClass().getName();
> I get a org.apache.ojb.broker.util.collections.ManageableArrayList.
> 
> The main problem I have is that there's not a lot of documentation about
> DCollections or ManageableCollections, so i was trying to guess which
> uses could be given to such classes (not just DList but the complete
> DCollection family and the ManageableCollection family also). Any ideas
> about that would be very interesting to me.
> 
> 
> On Fri, 2004-07-09 at 09:04, Thomas Dudziak wrote:
> > Martin I. Levi wrote:
> > 
> > > Hi!
> > > 
> > > As i didn't have an answer to my last mail 
> > > im writing again.
> > > 
> > > Lets suppose I have a mapping like the following:
> > > 
> > > 
> > >   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)
> > > 
> > > If I submit an OQL query like this:
> > > 
> > > "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 org.odmg.DList anymore, why is that?
> > > what are this Manageable* containers for?
> > > Are implemented any kind of queries which return DBags, DSets or DMaps?
> > 
> > OQL queries should return instances of the class specified via the 
> > OqlCollectionClass setting in OJB.properties. If you have a different 
> > class than ManageableArrayList configured there, then you've hit a bug.
> > 
> > Tom
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
-- 
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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OQL Queries returning collections (second try)

Posted by "Martin I. Levi" <ml...@labtie.mmt.upc.es>.
I'll try to send you a simplified version of the program and the mapping
(where you can see the problem) next week. Im working with 12 classes
and i think it won't help posting all that here.

On Fri, 2004-07-09 at 13:30, Thomas Dudziak wrote:
> Martin I. Levi wrote:
> 
> >Well I think this is what you are talking about:
> >
> >#----------------------------------------------------------------------------------------
> ># OQL / SQL settings
> >#----------------------------------------------------------------------------------------
> ># The OqlCollectionClass entry defines the collection type returned
> ># from OQL queries. By default this value is set to DListImpl.
> ># This will be good for most situations as DList allows maximum flexibility
> ># in a ODMG environment. See also section 'ODMG settings'.
> ># Using DLists for large resultsets may be bad for application performance.
> ># For these scenarios you can use ArrayLists or Vectors.
> ># Important note: the collections class to be used MUST implement the
> ># interface org.apache.ojb.broker.ManageableCollection.
> >#
> >OqlCollectionClass=org.apache.ojb.odmg.collections.DListImpl_2
> ># OqlCollectionClass=org.apache.ojb.broker.util.collections.ManageableArrayList
> ># OqlCollectionClass=org.apache.ojb.broker.util.ManageableVector
> >#
> >
> >
> >What happens here is that I get DListImpl_2 when I execute the typical
> >OQL query:   select myniceObjects from A.getClass().getName();
> >but when I ask for an embedded property, I mean something like:
> >select x.B.c from A.getClass().getName();
> >I get a org.apache.ojb.broker.util.collections.ManageableArrayList.
> >  
> >
> Could you provide the classes, and repository_user.xml for a sample that 
> shows your problem (e.g. A, B, C, D, Main) ? I'll then check whether 
> it's a bug in OJB.
> 
> >The main problem I have is that there's not a lot of documentation about
> >DCollections or ManageableCollections, so i was trying to guess which
> >uses could be given to such classes (not just DList but the complete
> >DCollection family and the ManageableCollection family also). Any ideas
> >about that would be very interesting to me.
> >  
> >
> AFAIK the Manageable family are the default collections used by the OJB 
> PB Api. They provide hooks for the persistence management of OJB. 
> Normally they are used transparently, e.g. in the Java class you define 
> the type java.util.Collection and OJB will use an ManageableArrayList 
> when loading the object from the database.
> An extension is provided by the RemovalAwareList which also keeps track 
> of removals and additions to the list which speeds up the operation 
> because only the changes have to be made persistent. In this regard, 
> this class is similar to the D family of the ODMG impl.
> 
> Since you're using ODMG, you should be fine with DListImpl_2 for the 
> OqlCollectionClass. If not then it might be a bug in OJB.
> 
> Tom
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
-- 
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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OQL Queries returning collections (second try)

Posted by Thomas Dudziak <to...@first.fhg.de>.
Martin I. Levi wrote:

>Well I think this is what you are talking about:
>
>#----------------------------------------------------------------------------------------
># OQL / SQL settings
>#----------------------------------------------------------------------------------------
># The OqlCollectionClass entry defines the collection type returned
># from OQL queries. By default this value is set to DListImpl.
># This will be good for most situations as DList allows maximum flexibility
># in a ODMG environment. See also section 'ODMG settings'.
># Using DLists for large resultsets may be bad for application performance.
># For these scenarios you can use ArrayLists or Vectors.
># Important note: the collections class to be used MUST implement the
># interface org.apache.ojb.broker.ManageableCollection.
>#
>OqlCollectionClass=org.apache.ojb.odmg.collections.DListImpl_2
># OqlCollectionClass=org.apache.ojb.broker.util.collections.ManageableArrayList
># OqlCollectionClass=org.apache.ojb.broker.util.ManageableVector
>#
>
>
>What happens here is that I get DListImpl_2 when I execute the typical
>OQL query:   select myniceObjects from A.getClass().getName();
>but when I ask for an embedded property, I mean something like:
>select x.B.c from A.getClass().getName();
>I get a org.apache.ojb.broker.util.collections.ManageableArrayList.
>  
>
Could you provide the classes, and repository_user.xml for a sample that 
shows your problem (e.g. A, B, C, D, Main) ? I'll then check whether 
it's a bug in OJB.

>The main problem I have is that there's not a lot of documentation about
>DCollections or ManageableCollections, so i was trying to guess which
>uses could be given to such classes (not just DList but the complete
>DCollection family and the ManageableCollection family also). Any ideas
>about that would be very interesting to me.
>  
>
AFAIK the Manageable family are the default collections used by the OJB 
PB Api. They provide hooks for the persistence management of OJB. 
Normally they are used transparently, e.g. in the Java class you define 
the type java.util.Collection and OJB will use an ManageableArrayList 
when loading the object from the database.
An extension is provided by the RemovalAwareList which also keeps track 
of removals and additions to the list which speeds up the operation 
because only the changes have to be made persistent. In this regard, 
this class is similar to the D family of the ODMG impl.

Since you're using ODMG, you should be fine with DListImpl_2 for the 
OqlCollectionClass. If not then it might be a bug in OJB.

Tom


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


Re: OQL Queries returning collections (second try)

Posted by "Martin I. Levi" <ml...@labtie.mmt.upc.es>.
Well I think this is what you are talking about:

#----------------------------------------------------------------------------------------
# OQL / SQL settings
#----------------------------------------------------------------------------------------
# The OqlCollectionClass entry defines the collection type returned
# from OQL queries. By default this value is set to DListImpl.
# This will be good for most situations as DList allows maximum flexibility
# in a ODMG environment. See also section 'ODMG settings'.
# Using DLists for large resultsets may be bad for application performance.
# For these scenarios you can use ArrayLists or Vectors.
# Important note: the collections class to be used MUST implement the
# interface org.apache.ojb.broker.ManageableCollection.
#
OqlCollectionClass=org.apache.ojb.odmg.collections.DListImpl_2
# OqlCollectionClass=org.apache.ojb.broker.util.collections.ManageableArrayList
# OqlCollectionClass=org.apache.ojb.broker.util.ManageableVector
#


What happens here is that I get DListImpl_2 when I execute the typical
OQL query:   select myniceObjects from A.getClass().getName();
but when I ask for an embedded property, I mean something like:
select x.B.c from A.getClass().getName();
I get a org.apache.ojb.broker.util.collections.ManageableArrayList.

The main problem I have is that there's not a lot of documentation about
DCollections or ManageableCollections, so i was trying to guess which
uses could be given to such classes (not just DList but the complete
DCollection family and the ManageableCollection family also). Any ideas
about that would be very interesting to me.


On Fri, 2004-07-09 at 09:04, Thomas Dudziak wrote:
> Martin I. Levi wrote:
> 
> > Hi!
> > 
> > As i didn't have an answer to my last mail 
> > im writing again.
> > 
> > Lets suppose I have a mapping like the following:
> > 
> > 
> >   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)
> > 
> > If I submit an OQL query like this:
> > 
> > "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 org.odmg.DList anymore, why is that?
> > what are this Manageable* containers for?
> > Are implemented any kind of queries which return DBags, DSets or DMaps?
> 
> OQL queries should return instances of the class specified via the 
> OqlCollectionClass setting in OJB.properties. If you have a different 
> class than ManageableArrayList configured there, then you've hit a bug.
> 
> Tom
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
-- 
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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OQL Queries returning collections (second try)

Posted by Thomas Dudziak <to...@first.fhg.de>.
Martin I. Levi wrote:

> Hi!
> 
> As i didn't have an answer to my last mail 
> im writing again.
> 
> Lets suppose I have a mapping like the following:
> 
> 
>   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)
> 
> If I submit an OQL query like this:
> 
> "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 org.odmg.DList anymore, why is that?
> what are this Manageable* containers for?
> Are implemented any kind of queries which return DBags, DSets or DMaps?

OQL queries should return instances of the class specified via the 
OqlCollectionClass setting in OJB.properties. If you have a different 
class than ManageableArrayList configured there, then you've hit a bug.

Tom


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