Bulk retrieval in HQL: could not execute native bulk manipulation query
- by user179056
Hello,
We are getting a "could not execute native bulk manipulation query" error in HQL
When we execute a query which is something like this.
String query = "Select person.id from Person person where";
String bindParam = "";
List subLists = getChucnkedList(dd);
for(int i = 0 ; i < subLists.size() ;i++){
bindParam = bindParam + " person.id in (:param" + i + ")";
if (i < subLists.size() - 1 ) {
bindParam = bindParam + " OR " ;
}
}
query = query + bindParam;
final Query query1 = session.createQuery(query.toString());
for(int i = 0 ; i < subLists.size() ;i++){
query1.setParameterList("param" + i, subLists.get(i));
}
List personIdsList = query1.list();
Basically to avoid the limit on IN clause in terms of number of ids which can be inserted (not more than 1000), we have created sublists of ids of not more
than 1000 in number.
We are using bind parameters to bind each sublist. However we still get error
"could not execute native bulk manipulation query"
How does one avoid the problem of limited parameters possible in IN query
when parameters passed are more than 1000?
regards
Sameer