ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Viv Kapadekar <vi...@peoplepowerco.com>
Subject Re: [IBatis3-beta10] nested results for collection
Date Wed, 07 Apr 2010 03:09:21 GMT
Yeah actually to make it more clear Class X also has desc. So its  
really:
Class X {
String id
String desc
List<Y> b
}
If index is null the desc is applicable for X and when its not null it  
should be applicable to X.

--V
On Apr 6, 2010, at 7:21 PM, Clinton Begin wrote:

> 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
>
>

---------------------------------------------------------------
Viv Kapadekar
vivek@peoplepowerco.com


Mime
View raw message