ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Utkarsh Ahuja" <ahuja.utka...@gmail.com>
Subject Re: Polymorphism question
Date Fri, 23 Mar 2007 23:44:18 GMT
HI Mikael,
You can do it something like this. I have used this and it works:

<result column="object_id" property="objectId"/>
        <!-- discriminators -->
        <discriminator column="active" nullValue="all" javaType="string">
            <subMap value="all"  resultMap="all"/>
            <subMap value="0" resultMap="inactive"/>
             <subMap value="1" resultMap="active"/>
          </discriminator>
    </resultMap>

<resultMap id="all" class="com.main.domain.Children">
        <result column="object_id" property="objectId"/>
        <!-- id translations -->
        <result column="object_id" property="children" select="
namespace.loadAllChildren"/>
    </resultMap>
    <resultMap id="inactive" class="com.main.domain.Children">
        <result column="object_id" property="objectId"/>
        <!-- id translations -->
        <result column="object_id" property="children" select="
namespace.loadInactiveChildren"/>
    </resultMap>
    <resultMap id="active" class="com.main.domain.Children">
        <result column="object_id" property="objectId"/>
        <!-- id translations -->
        <result column="object_id" property="children" select="
namespace.loadActiveChildrenl"/>
    </resultMap>

Thanks
Utkarsh

Mime
View raw message