链接:https://pan.baidu.com/s/15luDElW4oeEaP0nvEQ_40w 

提取码:i2r1

JdbcTemplate是Spring对JDBC的封装,目的是使JDBC更加易于使用。JdbcTemplate是Spring的一部分。

接下来,使用JdbcTemplate进行增删改查(CRUD)的操作

写一个pojo类(不是重点)

 1 package top.bigking.pojo;
 2 
 3 import java.util.Date;
 4 
 5 public class User {
 6     private Integer id;
 7     private String username;
 8     private String password;
 9     private Date birthday;
10     private Integer age;
11 
12     public User() {
13     }
14 
15     public User(Integer id, String username, String password, Date birthday, Integer age) {
16         this.id = id;
17         this.username = username;
18         this.password = password;
19         this.birthday = birthday;
20         this.age = age;
21     }
22 
23     public User(String username, String password, Date birthday, Integer age) {
24         this.username = username;
25         this.password = password;
26         this.birthday = birthday;
27         this.age = age;
28     }
29 
30     public Integer getId() {
31         return id;
32     }
33 
34     public void setId(Integer id) {
35         this.id = id;
36     }
37 
38     public String getUsername() {
39         return username;
40     }
41 
42     public void setUsername(String username) {
43         this.username = username;
44     }
45 
46     public String getPassword() {
47         return password;
48     }
49 
50     public void setPassword(String password) {
51         this.password = password;
52     }
53 
54     public Date getBirthday() {
55         return birthday;
56     }
57 
58     public void setBirthday(Date birthday) {
59         this.birthday = birthday;
60     }
61 
62     public Integer getAge() {
63         return age;
64     }
65 
66     public void setAge(Integer age) {
67         this.age = age;
68     }
69 
70     @Override
71     public String toString() {
72         return "User{" +
73                 "id=" + id +
74                 ", username='" + username + '\'' +
75                 ", password='" + password + '\'' +
76                 ", birthday=" + birthday +
77                 ", age=" + age +
78                 '}';
79     }
80 }
View Code

相关文章: