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: NullValues and complex properties
Date Fri, 11 Feb 2005 00:29:27 GMT
What happens if you don't use a nullValue?

Also, you could make use of the new resultMap attribute to manage the
complex relationship:

<result property="text" column="textValue_tid_id" resultMap="Text-result"/>

And then map all of the text properties in that result map.

Cheeers,
Clinton

On Thu, 10 Feb 2005 13:48:07 +0100, Okku <okku@stendahls.net> wrote:
> We have a lot of tables with pk:s of type int.
> 
> Some of the references to these table id:s can be null, since it is
> convenient to have the same type we use int everywhere, and since no ids in
> our database can have the value 0 we set the nullValue to 0.
> 
> This works well on classes without complex properties.
> 
> But for a resultmap like this:
> 
> <resultMap id="PropertyValue-result" class="pim.domain.PropertyValue">
>       <result property="mediaIdValue" column="mediaIdValue" />
>         <result property="id" column="id" />
>         <result property="propertyTypeId" column="propertyTypeId" />
>         <result property="text.id" column="textValue_tid_id" />
>         <result property="text.languageId" column="textValue_tid_languageId"
> nullValue="0" />
>         <result property="text.value" column="textValue_tid_value" />
> </resultMap>
> 
> Where we use a complex type text and one of the properties languageId can be
> null we get some strange behavior.
> 
> What we want is that the text property to be null if textValue_tid_id,
> textValue_tid_languageId and textValue_tid_value is null, but instead iBatis
> creates a new text property object and sets the languageId to 0.
> 
> Is this the correct behavior?
> 
> Regards Okku Touronen
> 
>

Mime
View raw message