You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Emrah Akdag (JIRA)" <ib...@incubator.apache.org> on 2007/11/29 11:10:43 UTC

[jira] Created: (IBATISNET-250) Nested resultMaps which inner has "groupBy" and outer not, gives System.NullReferenceException.

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.


[jira] Closed: (IBATISNET-250) Nested resultMaps which inner has "groupBy" and outer not, gives System.NullReferenceException.

Posted by "Gilles Bayon (JIRA)" <ib...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/IBATISNET-250?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gilles Bayon closed IBATISNET-250.
----------------------------------

    Resolution: Invalid

The first mapping should have a group by 

> 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.