You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by 陈抒 <cs...@gmail.com> on 2010/04/14 07:58:13 UTC

Can't connect to Oracle DB when using rownum in iBatis3

Hello:
   I have a select statement  like so:
   <select id="getExemption"
parameterType="freebird.exemption.business.QueryCondition"
resultMap="exemptionResultMap" >
        select exemption.id
,exemption.account_id,exemption.customer_id,exemption.customer_name,exemption.address1,exemption.address2,exemption.city,

exemption.state,exemption.country_code,exemption.zipcode,exemption.federal_id_type,exemption.federal_id,exemption.phone_number,exemption.email,

exemption.active,exemption_locations.country_code,exemption_locations.state_code,exemption_locations.reason_code,
        exemption_locations.permit_id,exemption_locations.start_date,
exemption_locations.end_date
        from exemption left join exemption_locations on exemption.id
=exemption_locations.exemption_id
        where exemption.account_id=#{accountId,jdbcType=VARCHAR}
        <if test="exemptionId!=null">
            and exemption.id=#{exemptionId,jdbcType=INTEGER}
        </if>
        <if test="customerId!=null">
            and exemption.customer_id=#{customerId,jdbcType=VARCHAR}
        </if>
        and rownum <= #{maxCount} order by id
    </select>
   I can't connect to my Oracle DB through SqlSessionFactory.openSession(),a
NullPointerExeption object was thrown out.
   When I remove the above red words,it works.Why?I think my select
statement is correct,because I tested in Oracle.
   I also tried 'and rownum<=1000',but still failed.

陈抒
Best regards
http://blog.csdn.net/sheismylife