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]

Reply via email to