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 Raymond Lukas <rl...@cadence.com> on 2002/12/20 17:03:25 UTC

BUG in setStart and setEndIndex method of AbstractQueryImpl ?

I think that we have a problem with the setStart and setEndIndex methods
of the org.apache.ojb.broker.query.AbstractQueryImpl object.  Here is
why I say this.  When I invoke this execute method with (startPos = 1,
endPos=3) and then again with (startPos = 4, endPos=8). I do not get the
desired (expected) results.   The following code returns 

 

      // criteria is basically empty and sorts by object id's

    public Response execute() {

        ResponseImpl response = new ResponseImpl();

        

        Query query = new QueryByCriteria(User.class, super.criteria);

            

        query.setStartAtIndex(super.startPos);

        query.setEndAtIndex(super.endPos);

        

        try {           

            broker.beginTransaction();

            

            response.setTotalCount(super.getMaxResultSetSize(query));

            

response.setResults((Collection)broker.getCollectionByQuery(

                                                query));

                  

            broker.commitTransaction();            

        }

        catch (Exception exc) {

            broker.abortTransaction();

            exc.printStackTrace();

        }

 

Records 100, 101 for the first request and records 100, 101, 103 and 104
for the second request. I am trying to use this mechanism for paging a
result set. 

 

I have 8 records (100-108). There must be something that I must forget
(null for garbage collection) between requests. But without and
example.. I tired creating a new default broker between each request and
that did not help.