Nested resultMaps which inner has "groupBy" and outer not, gives 
System.NullReferenceException.
-----------------------------------------------------------------------------------------------

                 Key: IBATISNET-250
                 URL: https://issues.apache.org/jira/browse/IBATISNET-250
             Project: iBatis for .NET
          Issue Type: Bug
          Components: DataMapper
    Affects Versions: DataMapper 1.6.1
            Reporter: Emrah Akdag


I am trying to use a resultmap (that has a "groupBy" clause) in another one 
(which has not a groupby). I am having NullRefereceException. The inner 
resultmap works alone. 

In my project I am using a Photo class that has Tag list on it. There is a 
groupBy in Photo resultmap to avoid use N+1 selects. Photo resultmap works 
perfect. All the tags for one photo is on Tags property which is an IList. I am 
trying to make a new class that has a property of type Photo. When I tried to 
use nested resultmap, I am getting a NullRefereceException.  Could you help me?

public class Photo {
    public int Id;
    public IList Tags;
}

public class Tag {
    public int Id;
    public string Name;
}

public class GroupPhoto {
     public int Id;
     public Photo Photo;
}

    <resultMap id="PhotoResult" class="Photo" groupBy="Id">
         <result property="Id" column="PHOTO_ID"/>
         <result property="Tags" resultMapping="XXX.TagResult"/>
    </resultMap>

     <resultMap id="TagResult" class="Tag">
         <result property="Id" column="TAG_ID"/>
         <result property="Name" column="TAG_NAME"/>
    </resultMap>

    <resultMap id="GroupResult" class="GroupPhoto">
      <result property="Id" column="GUI_ID"/>
      <result property="Photo" resultMapping="XXX.PhotoResult"/>
   </resultMap>

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

Reply via email to