1、工程目录结构如下
2、引入需要的jar包,如上图。
3、创建持久化类User对应数据库中的user表
package com.hibernate.配置文件.pojo; import java.sql.Date; public class User { private Integer id; private String username; private String password; private Date update_time; public User() { super(); } public User( String username, String password, Date update_time) { super(); this.username = username; this.password = password; this.update_time = update_time; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public Date getUpdate_time() { return update_time; } public void setUpdate_time(Date update_time) { this.update_time = update_time; } }