You have sqlMapConfig->sqlMapConfig->sqlMap. This is not correct. Delete sqlMapCollection.xml. Reference tts_user.xml directly in sqlMapConfig.xml.
Jeff Butler On Wed, May 28, 2008 at 10:57 AM, cuong PN <[EMAIL PROTECTED]> wrote: > > Hi guys > > I've been looking at this, searching the Internet, trying this and that but > nothing works yet. I'd greatly appreciate any help to resolve this. Thanks > so so much! > > When I run, I got this error: > > com.ibatis.sqlmap.client.SqlMapException: There is no statement named > TTS_USER.countUsers in this SqlMap. > > Even though after searching thru the net, I think my configuration looks > right, at least the namespace part. Or am I wrong? Funny thing is even if I > messed up the xml format of sqlmap file (like doing "</sqlMap----- #>" > instead of a correct closing tag "</sqlMap>), nothing is complained about. > Looks like SQLMaps isn't even reading that sqlmap file. Please kindly see > details below: > > ---- sqlMapConfig.xml ------ > <?xml version="1.0" encoding="UTF-8" ?> > <!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config > 2.0//EN" > "http://ibatis.apache.org/dtd/sql-map-config-2.dtd"> > > <sqlMapConfig> > > <properties resource="appSqlMapConfig.properties" /> > > <settings > useStatementNamespaces="true" > /> > > <transactionManager type="JDBC" > > <dataSource type="JNDI"> > <property name="DataSource" value="${appJNDI}"/> > </dataSource> > </transactionManager> > > <sqlMap resource="sqlMapCollection.xml" /> > </sqlMapConfig> > > ---- End of sqlMapConfig.xml ------ > > > ---- sqlMapCollection.xml ------ > <?xml version="1.0" encoding="UTF-8" ?> > <!DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config > 2.0//EN" > "http://ibatis.apache.org/dtd/sql-map-config-2.dtd"> > > <sqlMapConfig> > <sqlMap resource="sqlmap/sql/tts_user.xml" /> > </sqlMapConfig> > > ---- End of sqlMapCollection.xml ------ > > > ---- tts_user.xml ---- > <?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="TTS_USER"> > <select id="countUsers" resultClass="Integer"> > select count(*) from users > </select> > </sqlMap> > ---- End of tts_user.xml ---- > > And here's how I configure SQLMaps from java file: > > private static Reader reader; > private static String sqlMapConfigResource = > "location/to/config/file"; > > ... > reader = Resources.getResourceAsReader(sqlMapConfigResource); > sqlMapper = SqlMapClientBuilder.buildSqlMapClient(reader); > List resultList = sqlMapper.queryForList("TTS_USER.countUsers"); > logger.debug(resultList); > reader.close(); > > Hope to hear from your reply soon! Thanks again! > -- > View this message in context: > http://www.nabble.com/iBatis-configuration-problem-tp17516022p17516022.html > Sent from the iBATIS - User - Java mailing list archive at Nabble.com. > >
