ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c.ze...@ads.it
Subject Error: "There is no statement named..."
Date Tue, 18 Dec 2007 15:20:27 GMT
Hi all

The XML sql map (see below) contains a result map called "mapDatiCampo".
All XML files belong to the same namespace caled "GPJ"; namespaces, 
actually, are not used. Infact, the sql-map-config.xml have no setting for 
useSattementNamespaces and its default, as documented, is false.
"mapDatiCampo" is a unique identifier and is nowhere reused for other 
result maps
there are 11 XML Sql Map (other than the main sql-map-config.xml file): 
all their definoitions belong to the "GPJ" namespace. If possible I would 
prefer enable use of namespaces and to add namespaced ids to all XML Sql 
map file
There are hundreds of utest which prove that, untile now, iBatis works 
fine without using namepsaces, too

In spite of all that I got the following exception

  com.ibatis.sqlmap.client.SqlMapException: There is no statement named 
mapDatiCampo in this SqlMap.

(trace stack below).
Shall I set your config to use namespaces?

  <settings useStatementNamespaces="true"/>

as suggested by Graeme J Sweeney 
(http://www.mail-archive.com/user-java@ibatis.apache.org/msg04866.html)?

Larry Meadors recommended 
(http://www.mail-archive.com/user-java@ibatis.apache.org/msg01496.html) 
"to make the names unique, or enable namespaces" and in this case names 
are already unique.

Any suggestion?
Thanks in advance




Trace stack
com.ibatis.sqlmap.client.SqlMapException: There is no statement named 
mapDatiCampo in this SqlMap.
        at 
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:288)
        at 
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:552)
        at 
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:536)
        at 
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:93)
        at 
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:70)
        at 
it.finmatica.gpj.ec.istruzioni.EspressioneFabbricaImpl.getDatiCampo(EspressioneFabbricaImpl.java:143)
        at 
it.finmatica.gpj.ec.istruzioni.EspressioneFabbricaImpl.getOggettoPuntuale(EspressioneFabbricaImpl.java:102)
        at 
it.finmatica.gpj.ec.istruzioni.EspressioneFabbricaImpl.getOggettoPuntuale(EspressioneFabbricaImpl.java:1)
        at 
it.finmatica.gpj.aa.frontedb.InitFogliaFabbricaImpl.getOggetto(InitFogliaFabbricaImpl.java:105)
        at 
it.finmatica.gpj.aa.frontedb.InitFabbricaImpl.getOggetto(InitFabbricaImpl.java:48)
        at 
it.finmatica.gpj.ec.istruzioni.EspressioneFabbricaImplTest.testGetOggetto(EspressioneFabbricaImplTest.java:67)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at junit.framework.TestCase.runTest(TestCase.java:164)
        at junit.framework.TestCase.runBare(TestCase.java:130)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:120)
        at junit.framework.TestSuite.runTest(TestSuite.java:228)
        at junit.framework.TestSuite.run(TestSuite.java:223)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)



EspressioneFabbricaImpl.xml SQL Map file

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

<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
    "http://ibatis.apache.org/dtd/sql-map-2.dtd">

<sqlMap namespace="GPJ">

        <select id="esisteEspressione" resultClass="java.lang.Integer">
                select count( distinct( VALORE_ID ) )
                from IDENTIFICATORI_VALORE
                where VALORE_ID = #pId:INTEGER#
        </select> 

        <resultMap id="mapEspressione" 
class="it.finmatica.gpj.ec.istruzioni.EspressioneStruct">
                <result property="id" column="VALORE_ID" 
jdbcType="NUMERIC" javaType="int"/>
                <result property="idIdentificatore" 
select="selectIdIdentificatore" column="FORMULA_ID" javaType="int"/>
                <result property="idTipo" column="TIPO_RIGA_ID" 
jdbcType="NUMERIC" javaType="int" nullValue="-1"/>
                <result property="testo" column="TESTO" jdbcType="VARCHAR" 
javaType="java.lang.String"/>
        </resultMap>
 
 
        <select id="selectEspressione" resultMap="mapEspressione">
                select VALORE_ID
                         , FORMULA_ID
                         , TIPO_RIGA_ID
                         , TESTO
                from IDENTIFICATORI_VALORE
                where VALORE_ID = #id:INTEGER# 
        </select> 
 
        <select id="selectIdIdentificatore" resultClass="int">
                select IDENTIFICATORE_ID
                from IDENTIFICATORI_FORMULA
                where FORMULA_ID = #id:INTEGER# 
        </select> 
 
        <select id="selectIdPeriodoNormativo" resultClass="int">
                select NORMATIVA_ID
                from IDENTIFICATORI_FORMULA
                where FORMULA_ID = #id:INTEGER# 
        </select> 
 
        <select id="selectContaEspressione" resultClass="int">
                select count( VALORE_ID )
                from IDENTIFICATORI_VALORE
        </select>
 
        <resultMap id="mapDatiCampo" 
class="it.finmatica.gpj.ec.tipidato.TipoRigaStruct">
                <result property="idTipo" column="TIPO_DATO_ID" 
jdbcType="NUMERIC" javaType="int"/>
                <result property="nome" column="NOME" 
typeHandler="it.finmatica.gpj.aa.frontedb.NomeTypeHandlerCallback"/>
        </resultMap>
 
        <select id="selectDatiCampo" resultMap="mapDatiCampo">
                select TIPO_DATO_ID
                         , NOME
                from TIPI_DATO_RIGA
                where TIPO_RIGA_ID = #id:INTEGER# 
        </select> 
</sqlMap>

Mime
View raw message