其他分享
首页 > 其他分享> > SpringDataJpa idea自动生成实体类

SpringDataJpa idea自动生成实体类

作者:互联网

第一步 

 第二步

第三步 

第四步 

 第五步

 第六步

第七步 

第九步 

第十步

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);
	}
}

 

标签:实体类,return,name,int,age,idea,public,SpringDataJpa,id
来源: https://blog.csdn.net/qq_41520636/article/details/116380107