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 Goncalo Luiz <ge...@grace.no-ip.org> on 2003/06/30 01:02:37 UTC

Limit query results...

Hello.
Because the problems I related in my last e-mail I decided to use ODMG API.
I've come into another problem...how can I limit the number of objects returned by a query ?
With PB API I  could:
1 - use the QueryByCriteria.setStartAtIndex() and QueryByCriteria.setEndAtIndex(). If I had 100,000,000 rows in a DB I'd get only those between those indexes.
2 - use the getIteratorByQuery() who guarantees me that the objects are not loaded into memory on query execution. They only get materialized when I access them...

Is there any mechanism to do this whit ODMG API? I know that ODMG uses PB API, but I would't like to use the methodology described at the FAQ entry "I don't like OQL, can I use the PersistenceBroker Queries within ODMG?".

Thanks a lot.


----
Gonçalo Luiz - IST 4º Ano (PSI) 
gedl@grace.no-ip.org

Re: Limit query results...

Posted by Thomas Mahler <th...@web.de>.
Hi again Goncalo

Goncalo Luiz wrote:
> Hello. Because the problems I related in my last e-mail I decided to
> use ODMG API. I've come into another problem...how can I limit the
> number of objects returned by a query ? With PB API I  could: 1 - use
> the QueryByCriteria.setStartAtIndex() and
> QueryByCriteria.setEndAtIndex(). If I had 100,000,000 rows in a DB
> I'd get only those between those indexes. 2 - use the
> getIteratorByQuery() who guarantees me that the objects are not
> loaded into memory on query execution. They only get materialized
> when I access them...
> 
> Is there any mechanism to do this whit ODMG API? I know that ODMG
> uses PB API, but I would't like to use the methodology described at
> the FAQ entry "I don't like OQL, can I use the PersistenceBroker
> Queries within ODMG?".

As mentioned in the faq you can use the PB style queries in your ODMG 
applications too. there is no harm in it! I do it several heavy duty 
applications.

ODMG is a fixed API and it does *not* contain any of the features you 
mention :-(

We provide an extension to OqlQuery named EnhancedOqlQuery. this 
interface provides a create method with startAt and endAt parameters.

you can cast the result of odmg.newOqlQuery() to this interface and use 
this method.

There is no iterator support in ODMG.

cheers,
Thomas

> 
> Thanks a lot.
> 
> 
> ---- Gonçalo Luiz - IST 4º Ano (PSI) gedl@grace.no-ip.org