第一步
第二步
第三步
第四步
第五步
第六步
第七步
第九步
第十步
package com.hikktn.entity;
import javax.persistence.*;
import java.util.Objects;
/**
* @ClassName PersonEntity
* @Description TODO
* @Author lisonglin
* @Date 2021/5/3 20:15
* @Version 1.0
*/
@Entity
@Table(name = "person", schema = "test")
public class PersonEntity {
private int id;
private String name;
private Integer age;
@Id
@Column(name = "id", nullable = false)
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Basic
@Column(name = "name", nullable = true, length = 255)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Basic
@Column(name = "age", nullable = true)
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PersonEntity that = (PersonEntity) o;
return id == that.id && Objects.equals(name, that.name) && Objects.equals(age, that.age);
}
@Override
public int hashCode() {
return Objects.hash(id, name, age);
}
}