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


Reply via email to