ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: [IBatis3-beta10] nested results for collection
Date Wed, 07 Apr 2010 02:21:55 GMT
If iBATIS finds ANY values for the mapped properties, it will create the
object.  Is it possible that the desc column is populated even when the
index is null?

On Tue, Apr 6, 2010 at 7:52 PM, Viv Kapadekar <vivek@peoplepowerco.com>wrote:

> Hi
> I have a Class X containing a List of Class Y
>
> Class X {
> String a
> List<Y> b
> }
>
> Class Y {
> String index
> String desc
> }
>
> The resultMap I have is
>
> <resultMap id="someID" type="X">
>                <id property="a" column="id"/>
>                        <collection property="b" ofType="Y">
>                                      <id property="index" column="index" />
>                                        <result property="desc"
> column="desc"/>  -->
>                        </collection>
> </resultMap>
>
> This is fine, but I don't want the resulting X to have the collection b
> set, if the "index" value is null. If index is null, even the value of b in
> X should be null.  I tried using <discriminator> and also tried creating a
> separate sql, but no luck. Any ideas?
>
> -V
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

Mime
View raw message