ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anderson Forteleza" <afortal...@gmail.com>
Subject Help: This SQL map does not contain an ResultMap named xxx
Date Fri, 18 Aug 2006 10:44:22 GMT
Hello there ! I'm a newbie to iBatis and I'm excited by the possibilities it
gives me.

I'm trying to setup a basic test application where I can get values from the
Northwind database, I'm using SQL Server Express but when I try to run the
program I get the following error:

"This SQL map does not contain an ResultMap named Test.result"

IuseStatementNamespaces is set to false, but this error is showing up
anyway, here's some information:

<?xml version="1.0" encoding="utf-8"?>

  <properties resource="Resources/properties.config" />

    <setting useStatementNamespaces="false" />

  <providers resource="Resources/providers.config" />

  <!-- Database connection information -->
    <provider name="sqlServer2.0" />
    <dataSource name="Northwind" connectionString="Data
Source=DARKSTAR\SQLEXPRESS;Initial Catalog=Northwind;Integrated
Security=True" />

    <sqlMap resource="Resources/Maps/Customers.xml" />

I'm using the providers.config provided with iBatis DataMapper

Here's my DataMapper file:

<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="Test"

    <typeAlias alias="Customer" type="iBatisNorthwind.Customer" />

  <resultMap id="result" class="System.Collections.IList">
    <result property="CustomerID" column="CustomerID" />
    <result property="CompanyName" column="CompanyName" />
    <result property="ContactName" column="ContactName" />
    <result property="ContactTitle" column="ContactTitle" />
    <result property="Address" column="Address" />
    <result property="City" column="City" />
    <result property="Region" column="Region" />
    <result property="PostalCode" column="PostalCode" />
    <result property="Country" column="Country" />
    <result property="Phone" column="Phone" />
    <result property="Fax" column="Fax" />

    <select id="customersByCountry" param="System.String"
      <![CDATA[ SELECT * FROM Customers WHERE Country = #Country# ]]>

I've tryed to use the full name Test.result but to no avail. What is
interesting is that I see many people instanciating the singleton using this

SqlMapper mapper = Mapper.Instance();

But when I try to do that VS 2005 gives me a cast error message:

Error    119    Cannot implicitly convert type '
IBatisNet.DataMapper.ISqlMapper' to 'IBatisNet.DataMapper.SqlMapper'. An
explicit conversion exists (are you missing a cast?)
D:\Projects\iBatisNorthwind\Program.cs    13    32    iBatisNorthwind

Wich is weird because SqlMapper implements ISqlMapper. I'm typecasting then:

SqlMapper mapper = (SqlMapper)Mapper.Instance();

Here's the complete error message:
- The error occurred while loading SqlMap.
- loading select tag
- The error occurred in <sqlMap resource="Resources/Maps/Customers.xml"
xmlns="http://ibatis.apache.org/dataMapper" />.
- Check the Test.customersByCountry. --->
IBatisNet.DataMapper.Exceptions.DataMapperException: This SQL map does not
contain an ResultMap named Test.result
... callstack information...

I'm testing iBatis to use here in the school where I work, any help would be
appreciated :)

thank you
Anderson Fortaleza

View raw message