ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andras Linczmayer (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Created: (IBATIS-582) looped result maps is null if all other 'primitive' attributes are null
Date Thu, 19 Feb 2009 14:44:02 GMT
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.3, 2.3.2
            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.


Mime
View raw message