ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Tse <...@tsez.net>
Subject Strange behaviour when column is null
Date Thu, 25 Jan 2007 09:47:11 GMT
Hi all,

    I experienced a very strange problem with iBatis. Everything is fine 
until I add one more field named imagePath (String in java, varchar in 
Mysql) to the DB and the product POJO. If the field is null in MySQL , 
iBatis result a NestedSQLException. But a similar field called 
description have no problem at all when the field in DB is null. Then i 
replace the null field with something, then the exception is not thrown.

    Any input is appreciated.

Best regards,
Jonathan Tse

    Product.java (other member omitted for simplicity)
    private Long productId
    private String description;
    private String imagePath;

    And my xml file for this pojo :

<resultMap id="productResult" class="product">
        <result property="productId" column="product_id" />
        <result property="description" column="description" />
        <result property="imagePath" column="imagepath" />

<select id="getProductListByCategory" resultMap="productResult">
            select product_id, name, description, categoryid, listprice, 
hot, enabled, imagepath from product where
            categoryid = #value#

View raw message