Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate 2: how to write a query when the result is not in some list

 
John Landon
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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"?

Thanks for any ideas.
John.
 
John Landon
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
solved:
Query.setParameterList()
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John Landon wrote:solved:
Query.setParameterList()


Funny, I just did the same thing two days ago. It was driving me crazy that it was trying to set an int with an ArrayList, then noticed that I was calling setParameter() instead of setParameterList()

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic