Mybatis implements crud operation

Fairy-KunKun 2022-05-14 14:37:30 阅读数:999


(1) Entity class


(2)CRUD The essence is right Dept The operation of the object

stay pojo A self explosion was built under the package , Name it sqlmaps 

(3)Dept.xml(SQl Silver Snake file ) stay Configuation.xml( Master profile ) Register in

(4) test




There are only two reasons for not finding the file

(1) The path is wrong

(2) The file was not compiled

Maven All configuration files in the project are written in by default resources Next , That is to say , be not in resources The configuration file under will not be maven compile .

  How to solve ?

(1) writes resources Next

(2) Not in resources below , But I want to tell you maven, I am here java There is a configuration file in the code , such ,maven When you compile again, you will compile .

modify pom.xml