首页 > 代码库 > com.ibatis.sqlmap.client.SqlMapException: There is already a statement named search in this SqlMap.

com.ibatis.sqlmap.client.SqlMapException: There is already a statement named search in this SqlMap.

 Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath ‘/sqlMapConfig/sqlMap‘.  Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath ‘/sqlMap/select‘.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is already a statement named search in this SqlMap.
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53)

at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:86)

这个是因为没有启用命名空间,导致存在相同的SQL ID

解决方案如下:

<settings cacheModelsEnabled="true" enhancementEnabled="true"        lazyLoadingEnabled="true" errorTracingEnabled="true" maxRequests="32"        maxSessions="10" maxTransactions="5" useStatementNamespaces="true" />

 

com.ibatis.sqlmap.client.SqlMapException: There is already a statement named search in this SqlMap.