SQL Error: 1795, SQLState: 42000 - maximum number of expressions in a list is 1000

SQL Error: 1795, SQLState: 42000 - maximum number of expressions in a list is 1000

SELECT ID FROM PERSON WHERE ID IN (:personIds) AND ( HAS_PAID IS NULL OR HAS_PAID = 'N') ;

在上面的查询中,我传递了 list 之前在我的 Java 应用程序中创建的字符串。

上面的查询给出了我的应用程序中某些数据集的以下问题,因为列表 ( personIds ) 包含 1000 多个 成员:

WARN  o.h.internal.AbstractQueryImpl - HHH000443: Dialect [org.hibernate.dialect.Oracle10gDialect] limits the number of elements in an IN predicate to 1000 entries.  
However, the given parameter list [personIds] contained 1041 entries, which will likely cause failures to execute the query in the database
WARN  o.h.e.jdbc.spi.SqlExceptionHelper - SQL Error: 1795, SQLState: 42000
ERROR o.h.e.jdbc.spi.SqlExceptionHelper - ORA-01795: maximum number of expressions in a list is 1000

有什么方法可以更改我的查询,从而避免发生此错误?

您可以将列表拆分成更小的子列表,然后

where foo in (:list1) or foo in (:list2) or ....