I passed a list with more than 1000 elements in a HQL query and got this error
maximum number of expressions in a list is 1000
I read several posts on Stackoverflow which suggests to partition the list into a few sub lists.
Query query = session.createQuery(
"SELECT r.subject, COUNT(DISTINCT ss.id), COUNT(DISTINCT r.uid)\n" +
"FROM " + R.class.getName() + " r\n" +
"," + SS.class.getName() + " ss\n" +
"WHERE r.id = ss.id\n" +
"AND r.uid in (:listMoreThan1000)\n" +
"GROUP BY r.subject\n"
);
query.setParameterList("listMoreThan1000", listMoreThan1000);
List<Object[]> rows = query.list();
// code to parse the rows
I am new to HQL query and may anyone tell me how to partition listMoreThan1000
into a few sub lists in my code?