ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "meindert" <meind...@eduflex.com>
Subject RE: Can't connect to Oracle DB when using rownum in iBatis3
Date Wed, 14 Apr 2010 07:14:29 GMT
You can’t use the ‘<’ character, it is seen as a xml opening tag. Use &lt; instead

Or escape the whole query with <!-- --> 



From: 陈抒 [mailto:csfreebird@gmail.com] 
Sent: 14 April 2010 08:02 AM
To: user-java@ibatis.apache.org
Subject: Can't connect to Oracle DB when using rownum in iBatis3


   I have a select statement  like so:
   <select id="getExemption" parameterType="freebird.

exemption.business.QueryCondition" resultMap="exemptionResultMap" >
        select exemption.id <http://exemption.id/> ,exemption.account_id,exemption.customer_id,exemption.customer_name,exemption.address1,exemption.address2,exemption.city,
        exemption_locations.permit_id,exemption_locations.start_date, exemption_locations.end_date
        from exemption left join exemption_locations on exemption.id <http://exemption.id/>
        where exemption.account_id=#{accountId,jdbcType=VARCHAR}
        <if test="exemptionId!=null">
            and exemption.id <http://exemption.id/> =#{exemptionId,jdbcType=INTEGER}
        <if test="customerId!=null">
            and exemption.customer_id=#{customerId,jdbcType=VARCHAR}
        and rownum <= #{maxCount} order by id
   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

No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.801 / Virus Database: 271.1.1/2799 - Release Date: 04/13/10 22:22:00

View raw message