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...
Date Fri, 18 Aug 2006 10:50:58 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:

sqlMap.config
==========
<?xml version="1.0" encoding="utf-8"?>
<sqlMapConfig
  xmlns="http://ibatis.apache.org/dataMapper"
  xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance">

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

  <settings>
    <setting useStatementNamespaces="false" />
  </settings>

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

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

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

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

Here's my DataMapper file:

Customers.xml
===========
<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="Test"
  xmlns="http://ibatis.apache.org/mapping "
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

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

  <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" />
  </resultMap>

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

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
sintax:

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

Mime
View raw message