hi peter,

this is what the javadoc of Query.java (latest from cvs) says:

   /**
     *
     * @return the row at which the query should start retrieving results. 
     * If the start at index is 0, then ignore all cursor control.
     */
    int getStartAtIndex();

    /**
     * Set the row at which the query should start retrieving results,
inclusive
     * first row is 1
     * @param startAtIndex starting index, inclusive.
     */
    void setStartAtIndex(int startAtIndex);

    /**
     *
     * @return the row at which the query should stop retrieving results. 
     * If the end at index is 0, ignore all cursor control
     */
    int getEndAtIndex();

    /**
     * Set the row at which the query should stop retrieving results,
inclusive.
     * first row is 1
     * @param endAtIndex ending index, inclusive
     */
    void setEndAtIndex(int endAtIndex);

what kind/version of javadoc do you refer to ?

jakob

> Hi again,
> 
> After rethinking, what it looks like to me is:
> 
> - The row numbering starts from 1 (not from 0 as I assumed in my tests)
> - The startAtIndex and endAtIndex are inclusive(!) which is not what the
> JavaDocs say. Is this a Hsqldb-Problem or a general OJB problem?
> 
> Regards,
> 
> Peter
> 
> 
> 
> -----Urspr�ngliche Nachricht-----
> Von: Peter Wieland [mailto:[EMAIL PROTECTED] 
> Gesendet: Dienstag, 10. August 2004 10:22
> An: [EMAIL PROTECTED]
> Betreff: strange behaviour Query.setStartAtIndex() and
> Query.setEndAtIndex()
> 
> 
> Hi all,
> 
> I found something strange when using Query.setStartAtIndex(...)  and
> Query.setEndAtIndex(.).
> 
> The following is taken from a JUnit TestCase:
> 
>   Query query = getAQuerySomeWhere();
>   query.setStartAtIndex(start);
>   query.setEndAtIndex(end);
>   Collection result = broker.getCollectionByQuery(query);
>   assertTrue("Too many results", result.size() <= end - start);
> 
> The test passes, as long as start == 0. If start > 0, the test fails (in
> these cases result.size() == end - start + 1).
> 
> If I do
>   
>   Query query1 = getAQuerySomewhere();
>   query1.setStartAtIndex(0);  
>   query1.setEndAtIndex(10);
>   Collection result1 = broker.getCollectionByQuery(query1);
>   Query query2 = getAQuerySomewhere();
>   query2.setStartAtIndex(10);  
>   query2.setEndAtIndex(20);
>   Collection result2 = broker.getCollectionByQuery(query2);
> 
> the last element of result1 is the same as the first element of result2.
> According to the JavaDocs, the startAtIndex is inclusive, the endAtIndex
> is exclusive, hence, result1 and result2 should not have common
> elements.
> 
> I was using OJB 1.0rc5 with an HSQLDB database for these tests.
> 
> Any ideas?
>   
> Regards,
> 
> Peter
> 
> 
> ---------------------------------------------------------------------
> 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]
> 

-- 
NEU: WLAN-Router f�r 0,- EUR* - auch f�r DSL-Wechsler!
GMX DSL = superg�nstig & kabellos http://www.gmx.net/de/go/dsl


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

Reply via email to