我收到Exhausted Resultset错误。我正从db中检索大数据。 检索大量数据时会发生Exhaused resut set错误。当结果很小时,它工作正常。 这是我的代码:
OfferStackability.java
@Override
public void loadOfferStackability(Collection<Offer> offers) {
if (Utils.isNullOrEmpty(offers)) {
return;
}
Map<Long, Offer> offersMap = new HashMap<>();
for (Offer offer : offers) {
offersMap.put(offer.getId(), offer);
}
List<OfferStackability> offerStackabilities = offerStackabilityMapper.selectOffersStackability(new ArrayList<>(offersMap.keySet()));
}}
OfferStackability.xml
<select id="selectOffersStackability" parameterType="list" resultMap="OfferStackability" timeout="10000">
SELECT
OFFER_STACKABILITY_ID, OFFER_ID, STACKED_OFFER_ID, IS_EXTERNAL, created_by, modified_by
FROM
offer_app.OFFER_STACKABILITY
WHERE
OFFER_ID
IN
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<resultMap id="OfferStackability" type="OfferStackability">
<result property="id" column="OFFER_STACKABILITY_ID"/>
<result property="offerId" column="OFFER_ID" />
<result property="stackedId" column="STACKED_OFFER_ID" />
<result property="isExternal" column="IS_EXTERNAL" />
<result property="createdBy" column="created_by" />
<result property="modifiedBy" column="modified_by" />
</resultMap>
查询数据库时出错。原因:java.sql.SQLException:Exhausted Resultset