D:\eclipse\workspace\testIbatis
All Contact
Exception in thread "main" com.ibatis.sqlmap.client.SqlMapException: There is no statement named getAllContact in this SqlMap.
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:293)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:606)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:95)
at com.ibatis.jason.IbatisExample.main(IbatisExample.java:25)
搞不明白,又出错了。在网上找了大半天,调来调去的,也看不懂。最后无意中试了一下。程序正常运行了。原来是在xx.xml中sqlMap的namespace名字在查询方法中没有加。又在网上查了下: <sqlMap namespace="name"> 映射文件的根节点是<sqlMap>。namespace是该<sqlMap>的命名空间,因为SQL Map映射文件可以有多个,而对于SQL Map来说所有映射文件都是全局性的。这意味着在SQL Map中的标识只能是惟一的,利用namespace和标识的全限定名就可以进行区别,前提是,配置文件中的useStatementNamespaces属性必须设置为true。
All Contact
Exception in thread "main" com.ibatis.sqlmap.client.SqlMapException: There is no statement named getAllContact in this SqlMap.
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:293)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:606)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:95)
at com.ibatis.jason.IbatisExample.main(IbatisExample.java:25)
搞不明白,又出错了。在网上找了大半天,调来调去的,也看不懂。最后无意中试了一下。程序正常运行了。原来是在xx.xml中sqlMap的namespace名字在查询方法中没有加。又在网上查了下: <sqlMap namespace="name"> 映射文件的根节点是<sqlMap>。namespace是该<sqlMap>的命名空间,因为SQL Map映射文件可以有多个,而对于SQL Map来说所有映射文件都是全局性的。这意味着在SQL Map中的标识只能是惟一的,利用namespace和标识的全限定名就可以进行区别,前提是,配置文件中的useStatementNamespaces属性必须设置为true。