You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by Dipita Shah <di...@novitaz.com> on 2008/05/22 06:44:51 UTC

Question about ResultMaps and null values

Hi,
I am wondering can Ibatis handle complex types that have nulls?  For
example, I have one complex object that has other complex objects (each
having their own resultMap.) I want it such that if my first level column
attribute (storeMenuItems.price) is null, then I don't want it to go to the
next level.. I have the following mapping - is this valid?

 

<resultMap id="StoreMenuItems" class="storeMenuItems" >

        <result property="id" column="menuItemId">

        <result property="price" resultMap="Price" />

</resultMap >

 

<resultMap id="PricingLevel" class="PricingLevel" >

        <result property="pricingLevelType" column="pricingLevelTypeCd"
typeHandler="com.exit41.infra.contentmgr.dao.ibatis.PricingLevelTypeHandler"
/>

        <result property="pricingLevelValue" column="pricingLevelIdValue" />

</resultMap >

 

<resultMap id="Price" class="MenuItemPrice" >

        <result property="currency" column="currencyTypeCd" />

        <result property="price" column="priceAmount" />

        <result property="pricingLevel" resultMap="PricingLevel" />    

</resultMap >

 

Thanks!