Bulk retrieval in HQL: could not execute native bulk manipulation query

Posted by user179056 on Stack Overflow See other posts from Stack Overflow or by user179056
Published on 2010-05-05T11:25:53Z Indexed on 2010/05/05 11:28 UTC
Read the original article Hit count: 364

Filed under:

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

© Stack Overflow or respective owner

Related posts about hql