Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

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

 
Ranch Hand
Posts: 239
  • 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: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
solved:
Query.setParameterList()
 
ranger
Posts: 17344
11
Mac IntelliJ IDE 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
 
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!