Phase 3 1.Mybatis_05 use Mybatis complete CRUD_1 review Mybatis built environment - all functions for query




Mybits first review of environmental structures.

Directly next


direct click finish

to create a good project.

Everything write their own unrealistic, the head restraint file or copy over


import-dependent coordinates, Mybits

MySQL driver

log4j

unit test

log4j configuration file directly copied. Inside information provided.

Increased entity class


Implement serialization interface, and then declare member variables

to generate getter and setter methods and toString

SqlMapConfig.xml

Mybits main configuration file resoources below to create a




constraint copy of the header over.

Copied the head restraint

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration  
  PUBLIC "-//mybatis.org//DTD Config 3.0//EN"  
  "http://mybatis.org/dtd/mybatis-3-config.dtd">


First is the root element configuration


after generation of these selected




Configuration mapping file

Create a dao Interface



Create a map file

It should create a level folder

creation com then itheima then dao. Respectively, to create three folders.





Mapper constraints copied.


 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper  
  PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"  
  "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 

namespace which the process is to determine the interface inside the dao.

id refers to which method.

namespace + id on the formation method of fixing a dao interface

resourceType package means that we want to go

inside to configure sql statement

above will build a good environment.

Write the test class






Exception thrown an exception





Guess you like

Origin www.cnblogs.com/wangjunwei/p/11307083.html