Thanks, your last email enabled me to figure out my idiotic mistake. I was creating a Reader and building a SqlMapClient using the sqlmap.xml file instead of the sqlMapConfig.xml file! And then I just needed to have the sqlMap element in the right place in the sqlMapConfig file (to conform to the dtd) and now I am getting past the error. Thanks again!
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Larry Meadors Sent: Friday, July 07, 2006 2:58 PM To: Merritt, Norris Subject: Re: "There is no statement named getFoo in this sqlMap" error when there IS a statement with that exact id... Is it intentional that the <sqlMap ... /> tags are not there? Larry -----Original Message----- From: Merritt, Norris Sent: Friday, July 07, 2006 2:34 PM To: '[email protected]'; '[EMAIL PROTECTED]' Subject: RE: "There is no statement named getFoo in this sqlMap" error when there IS a statement with that exact id... I don't think I have namespaces enabled in sqlmapconfig, unless it is some sort of default. Here is my sql-map-config.xml file: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE sqlMapConfig SYSTEM "sql-map-config-2.dtd" > <sqlMapConfig> <transactionManager type="JDBC" > <dataSource type="SIMPLE"> <property name="JDBC.Driver" value="com.inet.tds.TdsDriver"/> <property name="JDBC.ConnectionURL" value="jdbc:inetdae7:NMERRITT"/> <property name="JDBC.Username" value="xxxxx"/> <property name="JDBC.Password" value="yyyyy"/> <property name="JDBC.DefaultAutoCommit" value="true" /> <property name="Pool.MaximumActiveConnections" value="10"/> <property name="Pool.MaximumIdleConnections" value="5"/> <property name="Pool.MaximumCheckoutTime" value="120000"/> <property name="Pool.TimeToWait" value="500"/> </dataSource> </transactionManager> </sqlMapConfig> -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Larry Meadors Sent: Friday, July 07, 2006 2:23 PM To: [email protected] Subject: Re: "There is no statement named getFoo in this sqlMap" error when there IS a statement with that exact id... Do you have namespaces enabled in sqlmapconfig? I bet lunch that you do. :-) Larry On 7/7/06, Merritt, Norris <[EMAIL PROTECTED]> wrote: > > > > > Obviously there is something wrong with the trivially simple sqlMap file > shown below, but being so new to iBatis I can't figure out what it is. > > If someone would kindly point it out I would appreciate it. Other folks > having this symptom were doing things with Abator and namespaces, which I am > not. > > > > The error occurs when I execute the line of code > > > > sqlMap.queryForObject("getFoo", paramMap, resultMap ); > > > > I expected to get a hashmap in resultMap consisting of name/value pairs for > all columns of the single row of footable that would be returned by my > select statement if it were executed, but instead I get: > > > > com.ibatis.sqlmap.client.SqlMapException: There is no > statement named getFoo in this SqlMap. > > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement( SqlMapExecutorDelegate.java:288) > > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlM apExecutorDelegate.java:552) > > at > com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSes sionImpl.java:97) > > at > com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClie ntImpl.java:74) > > at FooTest.main(FooTest.java:26) > > > > > > I know that my sqlMap xml file is being loaded and parsed because if I > introduce errors into it, the parser throws appropriate exceptions. > > As given below, the parser accepts the sqlMap file but I get the above > exception trying to do the query shown above. > > > > <sqlMap> > > > > <statement id="getFoo" parameterMap="getFooMap" > parameterClass="java.util.Map" resultClass="java.util.HashMap"> > > > > select * from dbo.footable as foo where foo.id = '#id#' > > > > </statement> > > > > <parameterMap id="getFooMap" class="java.util.HashMap"> > > <parameter property ="id" jdbcType="VARCHAR" javaType="string" /> > > </parameterMap> > > > > </sqlMap>
