mysql
mysql-connector-java
5.1.32
org.mybatis
mybatis
3.4.6
junit
junit
4.12
log4j
log4j
1.2.17
(4)创建相关配置文件
- jdbc.properties
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/test2
jdbc.username=root
jdbc.password=root
- log4j.properties
direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.err
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
direct messages to file mylog.log
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=c:/mylog.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
set log levels - for more verbose logging change ‘info’ to ‘debug’
log4j.rootLogger=debug, stdout
- sqlMapConfig.xml
(5)创建包结构
(6)创建实体类
- Order
package cn.itbluebox.domain;
import java.util.Date;
public class Order {
private int id;
private Date ordertime;
private double total;
public Order() {
}
public Order(int id, Date ordertime, double total) {
this.id = id;
this.ordertime = ordertime;
this.total = total;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Date getOrdertime() {
return ordertime;
}
public void setOrdertime(Date ordertime) {
this.ordertime = ordertime;
}
public double getTotal() {
return total;
}
public void setTotal(double total) {
this.total = total;
}
@Override
public String toString() {
return “Order{” +
“id=” + id +
“, ordertime=” + ordertime +
“, total=” + total +
‘}’;
}
}
- Role
package cn.itbluebox.domain;
public class Role {
private int id;
private String roleName;
private String roleDesc;
public Role() {
}
public Role(int id, String roleName, String roleDesc) {
this.id = id;
this.roleName = roleName;
this.roleDesc = roleDesc;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public String getRoleDesc() {
return roleDesc;
}
public void setRoleDes