I have the following problem. I am writing a query to get items for deletion. The amount of items could be from 100 thousand to a million. So if I do not use "setMaxResults" and retrieve each time limited amount (let's say 100) the call will just be stuck. So I retrieve each time 100. The problem is that there is another condition that cannot be part of the initial query. So I run through the partial result list and remove from that list the ones I do not want to delete (according to a condition that cannot be part of the query). Then I delete the rest and go back and retrieve another 100 and so on....
Now, the problem can be is if ALL the 100 are not good for deletion (as a result of the extra condition). If that's the case I will go back to the query and theoretically I can get the same 100 and keep spinning forever.
So my question is can I make a collection (or anything else) of the items that after the query are nor good for deletion and then in the next query say "get me all the items....but they cannot be in that collection"?