You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by c....@ads.it on 2007/12/18 16:20:27 UTC
Error: "There is no statement named..."
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>
Re: Error: "There is no statement named..."
Posted by c....@ads.it.
larry.meadors@gmail.com scritti il 18/12/2007 16:54:01
> So you do or don't want namespaces?
Right question, Larry.
Well, frankly I think I do not.
(I realize only now that if I do not want namespaces it would be probably
better to avoid to open XML Sql Map files with the
<sqlMap namespace="GPJ">
even it worked everything excellently until now...)
Re: Error: "There is no statement named..."
Posted by c....@ads.it.
larry.meadors@gmail.com scritti il 18/12/2007 16:54:01
> So you do or don't want namespaces?
>
> Larry
Following your suggestions (I would suggest using namespaces. It makes
things much cleaner in terms of organization.
http://www.mail-archive.com/user-java@ibatis.apache.org/msg01496.html) I
turned on namespaces (even if all XML SQL map files continue to share a
unique namespace) and namespaced the identifiers.
Beside, I detected a problem in the Java code (the 1st actual argument of
queryForObject(), the String id, was wrong and referred the map id instead
of the select id)
Now it works fine
Thanks for the help
ciao
Cesare
Re: Error: "There is no statement named..."
Posted by Larry Meadors <lm...@apache.org>.
So you do or don't want namespaces?
Larry
On Dec 18, 2007 8:49 AM, <c....@ads.it> wrote:
> If possible I would prefer to avoid to use namespaces and to add namespaced
> ids to all XML Sql map file
Re: Error: "There is no statement named..."
Posted by c....@ads.it.
c.zecca@ads.it scritti il 18/12/2007 16:20:27
Sorry for some errors and typos
> If
> possible I would prefer enable use of namespaces and to add
> namespaced ids to all XML Sql map file
If possible I would prefer to avoid to use namespaces and to add
namespaced ids to all XML Sql map file