import java.util.Objects;
import javax.persistence.*;
@Entity //get object ready for storage
class Student {
private @Id @GeneratedValue Long id; //making attributes
private String name;
private int period;
Student() {}
Student(String name, int period) {
this.name = name;
this.period = period;
}
public Long getId() {
return this.id;
}
public String getName() {
return this.name;
}
public String getRole() {
return this.period;
}
public void setId(Long id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setRole(String period) {
this.period = period;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof Student))
return false;
Student student = (Student) o;
return Objects.equals(this.id, student.id) && Objects.equals(this.name, student.name)
&& Objects.equals(this.period, student.period);
}
@Override
public int hashCode() {
return Objects.hash(this.id, this.name, this.period);
}
@Override
public String toString() {
return "Student{" + "id=" + this.id + ", name='" + this.name + '\'' + ", period='" + this.period + '\'' + '}';
}
}