1. 项目结构
2. 三个持久化类
① Pay.java
package com.baidu.cfghbm;
public class Pay {
//月薪
private Integer monthlyPay;
//年薪
private Integer yearPay;
//带薪假
private Integer vocationWithPay;
//
private Worker worker;
public Worker getWorker() {
return worker;
}
public void setWorker(Worker worker) {
this.worker = worker;
}
public Integer getMonthlyPay() {
return monthlyPay;
}
public void setMonthlyPay(Integer monthlyPay) {
this.monthlyPay = monthlyPay;
}
public Integer getYearPay() {
return yearPay;
}
public void setYearPay(Integer yearPay) {
this.yearPay = yearPay;
}
public Integer getVocationWithPay() {
return vocationWithPay;
}
public void setVocationWithPay(Integer vocationWithPay) {
this.vocationWithPay = vocationWithPay;
}
}
② Person.java
package com.baidu.cfghbm;
import java.sql.Blob;
import java.util.Date;
public class Person {
private Integer id;
private String name;
private String shiYan;
public String getShiYan() {
return shiYan;
}
public void setShiYan(String shiYan) {
this.shiYan = shiYan;
}
private String interest;
private Date birth;
//该属性的值为:name :birth
private String desc;
//映射长文本
private String content;
//映射二进制
private Blob image;
public Person() {
super();
}
public Person(String name, String interest, Date birth) {
super();
this.name = name;
this.interest = interest;
this.birth = birth;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Blob getImage() {
return image;
}
public void setImage(Blob image) {
this.image = image;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getInterest() {
return interest;
}
public void setInterest(String interest) {
this.interest = interest;
}
public Date getBirth() {
return birth;
}
public void setBirth(Date birth) {
this.birth = birth;
}
}
③ Worker.java