[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ojb-user
Subject:    Re: Size of database result
From:       Thomas Mahler <thma32 () web ! de>
Date:       2004-05-26 8:33:41
Message-ID: 40B45665.10808 () web ! de
[Download RAW message or body]

Hi Enrique,

Enrique Medina wrote:
> Hi everyone,
> 
> My question is related to the volume of information OJB retrieves from 
> DB in several ways:
> 
> 1) When I retrieve any object using getCollectionByQuery(), how many 
> records are retrieved? Are all the records found in the database?
> 

all records matching your query are returned in one collection.

> 2) If I use getIteratorByQuery(), how many records are retrieved at a 
> time, only one by one?

all records matching your query are found and returned in a jdbc 
resultset. but OJB does not materialize business objects in one go but 
only one by one with each Iterator.next() call.
This can safe resources if working with very large query results.

> 
> 3) If in the query I use query.setStartAtIndex(X) and 
> query.setEndAtIndex(Y), can I be sure that only records from X to Y are 
> retrieved, which are a count of Y-X? (Maybe JDBC method 'setMaxRows' is 
> used somewhere)
> 

AFAIK we do not work with offsets in jdbc queries. that means that the 
query returns a resultset witch ALL records matching your query.
And the StartIndex / EndIndex setting simply define that only records 
from X to Y are materialized.

> 4) If I set proxy-prefetching-limit to X, can I be sure that only X 
> records are retrieved from DB, even if I use a proxy? How and when does 
> OJB retrieve the rest of the records?

AFAIK this setting does only affect the automatic handling of references 
in loading objects nets. It does not directly affect the number of 
elemets retrieved by a query.

say you have two classes A and B. A has a collection of B elements.
say you set proxy-prefetching-limit of class B to 20.

If you then load an A object then only up to 20 Bs are prefetched.
Of course if the A object has a total of 100 Bs, OJB will take care to 
load the rest 80 objects when your application tries retrive them from 
the proxied collection.

cheers,
Thomas

> 
> Thanks in advance,
> Enrique Medina.
> 
> _________________________________________________________________
> ¿Dónde se esconden l@s solter@s? Encuentra miles de perfiles en MSN Amor 
> & Amistad. http://match.msn.es/
> 
> 
> ---------------------------------------------------------------------
> 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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic