在设置参数时,我在mybatis中使用了Resultset

时间:2016-10-25 10:03:52

标签: java mybatis

我收到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

文件中可能存在错误[/home/tomcat/services/ofrs-1.0.0-1064483-v-1/webapps/ofrs_1.0.0-1064483/WEB-INF/classes/com/cobalt/services/offers /config/mybatis/mappers/OfferStackabilityMapper.xml]

该错误可能涉及com.cobalt.services.offers.dao.mybatis.mappers.OfferStackabilityMapper.selectOffersStackability-Inline

设置参数

时发生错误

0 个答案:

没有答案