You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Bob Hanson <mn...@gmail.com> on 2005/03/03 21:27:48 UTC

resultMapping attribute

In example 25 at http://ibatisnet.sourceforge.net/DevGuide.html the
resultMapping attribute is shown for the .NET implementation.

But it's functionality is not documented anywhere. I had assumed it
was just a quick way to map a complex property. But it also seems to
execute a query.

Could someone please explain how this attribute is supposed to work.

Re: resultMapping attribute

Posted by Bob Hanson <mn...@gmail.com>.
I downloaded that file and searched for "resultMapping" and didn't
find anything in the documentation.

If resultMapping doesn't perform a query I'm confused because the following:
    <resultMap id="ElectronicRecordingType-result"
class="ElectronicRecordingType">
      <result property="Id" column="eRecordingTypeId"/>
      <result property="Description" column="description"/>
      <result property="Category"
resultMapping="ElectronicRecordingCategory.ElectronicRecordingCategory-result"/>

ends up creating an object that no only contains the values for Id and
Description, but also fills in Category with its proper Id and
Description.

My sql looks like:
    <select id="ElectronicRecordingType-select" parameterClass="int"
resultMap="ElectronicRecordingType-result">
      SELECT eRecordingTypeId, description, eRecordingCategoryId
      FROM   eRecordingType
    <dynamic prepend="WHERE">
      <isParameterPresent>
        eRecordingTypeId = #value#
      </isParameterPresent>
    </dynamic>
    </select>

How is iBATIS retrieving information from my eRecordingCategory table
without my specifing something like:
<result property="Category" column="eRecordingCategoryId"
select="ElectronicRecordingCategory-select"/>

I had assumed I had to do the latter but after testing the former, I
was getting the correct data which is why I came here with my
questions.


On Thu, 3 Mar 2005 23:34:52 +0100, Gilles Bayon <ib...@gmail.com> wrote:
> The online html guide is not updated on Sourceforge.
> Download the last documentation
> 
> http://sourceforge.net/project/showfiles.php?group_id=109704&package_id=131695&release_id=296537
> 
> -Gilles
>

Re: resultMapping attribute

Posted by Gilles Bayon <ib...@gmail.com>.
it doesn't execute a query.

Re: resultMapping attribute

Posted by Gilles Bayon <ib...@gmail.com>.
The online html guide is not updated on Sourceforge.
Download the last documentation 

http://sourceforge.net/project/showfiles.php?group_id=109704&package_id=131695&release_id=296537

-Gilles