Created
November 10, 2019 16:46
-
-
Save Eragoo/4a9ebc6c56ef21739015c8af16eaff1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Entity; | |
import javax.persistence.*; | |
@Entity | |
@Table(name = "students", schema = "main", catalog = "") | |
public class StudentsEntity { | |
private short id; | |
private String name; | |
private String surname; | |
@Id | |
@Column(name = "id", nullable = false) | |
public short getId() { | |
return id; | |
} | |
public void setId(short id) { | |
this.id = id; | |
} | |
@Basic | |
@Column(name = "name", nullable = false, length = -1) | |
public String getName() { | |
return name; | |
} | |
public void setName(String name) { | |
this.name = name; | |
} | |
@Basic | |
@Column(name = "surname", nullable = false, length = -1) | |
public String getSurname() { | |
return surname; | |
} | |
public void setSurname(String surname) { | |
this.surname = surname; | |
} | |
@Override | |
public boolean equals(Object o) { | |
if (this == o) return true; | |
if (o == null || getClass() != o.getClass()) return false; | |
StudentsEntity that = (StudentsEntity) o; | |
if (id != that.id) return false; | |
if (name != null ? !name.equals(that.name) : that.name != null) return false; | |
if (surname != null ? !surname.equals(that.surname) : that.surname != null) return false; | |
return true; | |
} | |
@Override | |
public int hashCode() { | |
int result = (int) id; | |
result = 31 * result + (name != null ? name.hashCode() : 0); | |
result = 31 * result + (surname != null ? surname.hashCode() : 0); | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment