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 Smail Louahchi <sm...@web.de> on 2003/09/01 04:17:08 UTC

limit query

Hi,

how can i limit the result in OJB.

Smail Louahchi




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


Re: limit query

Posted by SL <sl...@adequates.com>.
Hi,
the select limit is database specific.
For exemple MS SQL Server can only limit size off resultset, no "paging"
functions aviable, so real limit query has no effect.
With MySQL and PB API, you can try this way :


Query query = QueryFactory.newQuery(clazz, criteria);
if (useLimit) {
	query.setStartAtIndex(offset+1);
	query.setEndAtIndex(offset+limit+1);
}
Collection collection = broker.getCollectionByQuery(query);

regards
		
"Smail Louahchi" <sm...@web.de> wrote:

> Hi,
> 
> how can i limit the result in OJB.
> 
> Smail Louahchi
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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


Re: limit query

Posted by Smail Louahchi <sm...@web.de>.
thx, works great ;-)

Smail Louahchi





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


Re: limit query

Posted by Thomas Cornet <th...@cornet.name>.
Take a look at these methods, they should be usefull for you :

org.apache.ojb.broker.query.Query.setEndAtIndex()
org.apache.ojb.broker.query.Query.setStartAtIndex()

Thomas

At 04:17 01/09/2003, you wrote:
>Hi,
>
>how can i limit the result in OJB.
>
>Smail Louahchi
>
>
>
>
>---------------------------------------------------------------------
>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