目录
实验任务3:创建User实体类(根据你自己数据库表字段进行编写)和Dao
实验任务4:配置mybatis-config.xml和Mapper等文件
实验目的:
1、掌握MyBatis项目的创建过程。
2、掌握MyBatis配置文件的编写
3、掌握MyBatis的开发步骤与过程
4、使用MyBatis完成客户的增、删、改、查操作。
实验内容:
myBatis简介:可以简单读一下这位作者的文档:
MyBatis简介https://blog.csdn.net/chaizepeng/article/details/119384531
实验任务1:创建项目,介个都会吧!
首先打开IDEA创建一个maven-web项目。。。。。然后咱们要配置pom文件,把下面这段代码插进pom.xml中(重要!!!)
<!-- https://mvnrepository.com/artifact/org.mybatis/mybatis -->
<!--添加mybatis依赖-->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.4.6</version>
</dependency>
<!--jdbc驱动-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.47</version>
</dependency>
<!--junit测试类-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>compile</scope>
</dependency>