当前位置:网站首页>org. apache. ibatis. exceptions. PersistenceException:

org. apache. ibatis. exceptions. PersistenceException:

2022-06-25 21:22:00 vancomycin

 

stay mybatis Encountered in framework org.apache.ibatis.exceptions.PersistenceException problem , Because it is common in test mapping files , If you make a small mistake, it will happen , So I summarize it for myself , Of course, I hope it can help you !!!

analysis
There's this org.apache.ibatis.exceptions.PersistenceException Most of the problems are that the mapping file cannot be found , This and not following mybatis Of mapper Agent configuration specification
for example :
1、 There is a problem reading and writing the file , The system cannot find this file

2、mapper Interface and mapping mapper.xml Whether the names of are consistent , Whether it is in the same directory .

3、SqlMapConfig.xml Profile loading mapper There is an error in the path of the interface file ( There are generally two kinds of tests , First scan

class <mapper class=:“ Class path and class name ”/> The second batch scan load : Select scan package < package name=“ Package name ” / >)

4、 Use mapper Agent method development mapper Interface mapper.xml Medium namespace And mapper The classpath of the interface is the same

Same as , Forget to write namespace This exception will also be reported .
 

原网站

版权声明
本文为[vancomycin]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202181329515853.html