BUG: Error when using MyBatis;
Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause:java.lang.IllegalArgumentException:Mapped Statements collection does not contain value for Mycom.mapping.SampleMapper.selectByPrimaryKey ### Cause:java.lang.IllegalArgumentException:Mapped Statements Collection does not contain value for Mycom.mapping.SampleMapper.selectByPrimaryKey at ORG.APACHE.IBATIS.EXCEPTIONS.E Xceptionfactory.wrapexception (exceptionfactory.java:26) at Org.apache.ibatis.session.defaults.DefaultSqlSession.selectList (defaultsqlsession.java:111) at Org.apache.ibatis.session.defaults.DefaultSqlSession.selectList (defaultsqlsession.java:102) at Org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne (defaultsqlsession.java:66) at Mycom.test.mybatis.test.MybatisTest.main (mybatistest.java:43) caused by:java.lang.IllegalArgumentException: Mapped statements collection does not contain value for Mycom.mapping.SampleMapper.selectByprimarykey at Org.apache.ibatis.session.configuration$strictmap.get (configuration.java:797) at Org.apache.ibat Is.session.Configuration.getMappedStatement (configuration.java:631) at Org.apache.ibatis.session.Configuration.getMappedStatement (configuration.java:624) at Org.apache.ibatis.session.defaults.DefaultSqlSession.selectList (defaultsqlsession.java:107) ... 3 more
Cause: The following mapping SQL's identity string is inconsistent with the namespace () in Samplemapper.xml, previously handwritten namespace, when named, using the Mapper.xml directory, which was automatically generated by the tool Mapper.xml,namespac E name is used in the DAO directory;
String statement2 = "Mycom.mapping.SampleMapper.selectByPrimaryKey";//Mapping SQL's identity string
Sample result = Session.selectone (Statement2, 2);
SYSTEM.OUT.PRINTLN (result);