我有一个包含70个元素的列表。
例如:
例如:
List<Long> dbList = new ArrayList<Long>();
dbList
有70条记录。如果我将所有记录发送到MySql查询中,那么会花费很长时间。所以现在我想每次发送10个元素到数据库查询。因此,我需要按10的间隔迭代列表。如何做到这一点?这是避免使用IN
时长时间等待的好方法吗?
SQL查询
select model.boothId, model.panchayat.panchayatId
from Table1 model
where model.panchayat.panchayatId in(:locationValues)
and model.publicationDate.publicationDateId in (:publicationDateIdsList)
and model.constituency.id = :id group by model.panchayat.panchayatId
Thanks in advance...