It's not implemented in OJB version 0.9.8. I had to extend
org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl class to build
alter select statement with TOP keyword. 

Max Vesely -    Dynax Solutions, Inc.
Main:           212 889 7722
Direct:         212 331 8627
Mobile:         732 803 2115
E-Mail:         [EMAIL PROTECTED]



-----Original Message-----
From: Ron Gallagher [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 12, 2003 2:32 PM
To: [EMAIL PROTECTED]
Subject: Re: Selecting Top 10 records??


Try using

query.setStartAtIndex(0);
query.setEndAtIndex(10);

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

> 
> From: "Ismail Siddiqui" <[EMAIL PROTECTED]>
> Date: 2003/03/12 Wed PM 02:26:35 EST
> To: "OJB Users List" <[EMAIL PROTECTED]>
> Subject: Selecting Top 10  records??
> 
> Hi all
> I am using QueryByCriteria  as following
> 
> PersistenceBroker broker = 
> PersistenceBrokerFactory.defaultPersistenceBroker();
>               broker.beginTransaction();
>               Criteria c = new Criteria();
>               c.addEqualToColumn("program_instance_id",
program_instance_id+"");
>               c.addOrderByDescending("score");
>               QueryByCriteria query = new QueryByCriteria(Game.class, c);
>                         Collection game = 
> broker.getCollectionByQuery(query);
> 
> I am running microsoft sql server and want to select only top 5 
> records ..like select top 5  * where ....  How can I put this 
> condition in Criteria
> 
> 
> Thanks
> 
> ismail
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to