「in」式の1つに1000以上のアイテムがある場合に問題が発生する以下のHibernate NamedQueryがあります。(:devices) の ma.deviceId に 1000 個以上のアイテムがあると、java.sql.SQLException: ORA-01795: maximum number of expressions in a list is 1000 が発生します。
私が注意する必要がある唯一の "in" 式は、"and ma.deviceId in (:devices)" です。この NamedQuery を書き直す方法について何か考えがある人はいますか? JPAとHibernateを使用しています。
@NamedQuery(name = "Messages.findMessages", query = " SELECT ma from Messages ma JOIN FETCH ma.messagePayLoadXml mx LEFT OUTER JOIN FETCH ma.messageProperties mp " +
" WHERE ma.customerId = :customerId and ma.time >= :startTime and ma.time <= :endTime " +
" and ma.deviceId in (:devices) and mx.messageType = 'XML' and mx.alerts in " +
" ( select mtfm.messageType from MessageTypeFeatureMap mtfm where mtfm.feature in (:featureType) ) " +
" and ma.messageKey = mx.messageKey and ( mp.deleted = 0 or mp.deleted is null ) " +
" order by ma.time desc " )