Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
2 replies Latest Post - ‏2009-02-23T21:00:22Z by SystemAdmin
SystemAdmin
SystemAdmin
199 Posts
ACCEPTED ANSWER

Pinned topic moCurrentQuery.hasNext() is not returning false

‏2009-02-19T17:11:03Z |
We are having a problem with the following code. moCurrentQuery.hasNext() is not returning false and continuing to loop the resultset indefinetly. Any help is appreiciated.
This is how we are doing in our code:
0. VWQueue.createQuery(null, null, null, VWQueue.QUERY_NO_OPTIONS, filter, subVar, VWFetchType.FETCH_TYPE_WORKOBJ ECT);
1. START OF LOOP
2. if(moCurrentQuery.hasNext()== false)
return;
3. workItem = moCurrentQuery.next();
process
4. END OF LOOP.
For some reason, this loop is never ending when it starts first time in the day.
For example, if it grabs 100 items, it is looping 100 items again and again. Meaning the pointer of the filenet resultset is being reset to first row. It is never going into the step 2 above and finishing the loop.
Updated on 2009-02-23T21:00:22Z at 2009-02-23T21:00:22Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    199 Posts
    ACCEPTED ANSWER

    Re: moCurrentQuery.hasNext() is not returning false

    ‏2009-02-19T22:48:23Z  in response to SystemAdmin
    why dont you try the while loop (as shown below) instead of the the if condition within a loop. I dont know if that is the problem, but i used the hasNext() method with the while loop (as shown below) and it works fine for me...

    //other code
    vwQry = vwRoster.createQuery(null,null,null,1,sQueryStr,null,VWFetchType.FETCH_TYPE_WORKOBJECT);

    while (vwQry.hasNext()){
    vwElem = (VWWorkObject) vwQry.next();
    // other code
    }
    • SystemAdmin
      SystemAdmin
      199 Posts
      ACCEPTED ANSWER

      Re: moCurrentQuery.hasNext() is not returning false

      ‏2009-02-23T21:00:22Z  in response to SystemAdmin
      It was part of our architecture, so and that code is everywhere in all our application. And it is working fine everywhere. For that matter, this code also works many times, but doesn't work sometimes.
      Any clues....