You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Kai Grabfelder (JIRA)" <ib...@incubator.apache.org> on 2009/02/20 10:55:02 UTC

[jira] Commented: (IBATIS-582) looped result maps is null if all other 'primitive' attributes are null

    [ https://issues.apache.org/jira/browse/IBATIS-582?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12675305#action_12675305 ] 

Kai Grabfelder commented on IBATIS-582:
---------------------------------------

I guess 2.3.4 is affected as well? Fell free to attach a patch against the trunk for this issue...

> looped result maps is null if all other 'primitive' attributes are null
> -----------------------------------------------------------------------
>
>                 Key: IBATIS-582
>                 URL: https://issues.apache.org/jira/browse/IBATIS-582
>             Project: iBatis for Java
>          Issue Type: Bug
>    Affects Versions: 2.3.2, 2.3.3
>            Reporter: Andras Linczmayer
>
> If all of the 'primitive' properties of a resultMap are null and it has other child resultMap then the child resultMap won't be evaluated therefore the result entity will contain corrupt missing data.
> Example:
>   <resultMap id="personResult" class="Person" groupBy="id">
>     <result property="id" column="person_id" />
>     <result property="something" column="something" />
>     <result property="defaultDetails" resultMap="Person.personDetailsResult" />
>   </resultMap>
>   <resultMap id="personDetailsResult" class="person.data.HotelDetails">
>     <result property="description" column="personDetails_description" />
>     <result property="information" column="personDetails_information" />
>     <result property="eyeIdentifier" resultMap="Person.personEyeIdentifierResult" />
>   </resultMap>
>   <resultMap id="personEyeIdentifierResult" class="person.data.EyeIdentifier">
>     <result property="color" column="eye_color" />
>     <result property="size" column="eye_size" />
>     <result property="sin" column="eye_sin" />
>   </resultMap>
> If personDetails_description, personDetails_information column of appropriate ResultSet are SQL null then the eyeIdentifier will be also null despite the eye_color, eye_size and eye_sin of the result map are not SQL null.
> The problem is near to the references of com.ibatis.sqlmap.engine.scope.StatementScope.rowDataFound.
> Ibatis - instead of implementing the common sense initializing the properties by step by step via a recursive solution - splits the initialization into two parts: first the primitives types and only after that the class types. Unfortunately if all the primitives are null (rowDataFound=false, see ResultMap getResult(..) function) then the nested children result maps won't be evaluated because of the 'if (statementScope.isRowDataFound())' condition of the ResultMap.setNestedResultMappingValue(..)  method.   

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.