Exceptions encountered when learning ibatis
You may have written multiple ORM configuration files, and crud operations are performed in each configuration file, it is inevitable that two or more configuration files have one statement id named find ***,
<Statement id = "findbyid" parameterclass = "Java. Lang. Integer" resultmap = "bookmap">
<Statement id = "findbyid" parameterclass = "Java. Lang. Integer" resultmap = "pubmap">
When getsqlmapclient (). Update ("findbyid", ID) is used, which ORM does findbyid belong?
Exceptions may occur during the test:
Exception in thread "Main" Java. Lang. runtimeexception: error occurred.Cause: 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: org. xml. Sax. saxparseexception: Attribute "namespace" must be declared for element type "sqlmap ".
This introduces a namespaces. To show the difference, configure a node in the core configuration file of ibatis.
<Sqlmapconfig>
<Settings usestatementnamespaces = "true" lazyloadingenabled = "true"/>
<Sqlmap resource = ".......
Modify the root node<Sqlmap namespace = "book">
Change the test statement to getsqlmapclient (). Update ("Book.Findbyid ", ID.