You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Okku <ok...@stendahls.net> on 2005/02/10 13:48:07 UTC

NullValues and complex properties

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