ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Randy Layman" <Randy.Lay...@vocalocity.com>
Subject RE: Strange behaviour when column is null
Date Thu, 25 Jan 2007 12:24:41 GMT

	Could you include the SQL Exception that you are receiving?


-----Original Message-----
From: Jonathan Tse [mailto:dev@tsez.net] 
Sent: Thursday, January 25, 2007 4:47 AM
To: user-java@ibatis.apache.org
Subject: Strange behaviour when column is null

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