Uploaded image for project: 'iBatis for .NET'
  1. iBatis for .NET
  2. IBATISNET-250

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • DataMapper 1.6.1
    • None
    • DataMapper
    • None

    Description

      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>

      Attachments

        Activity

          People

            Unassigned Unassigned
            emrahakdag Emrah Akdag
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: