source: src/main/java/project/educatum/model/primarykeys/TeacherStudentRelationID.java

Last change on this file was d3cf3a1, checked in by Marija Micevska <marija_micevska@…>, 2 years ago

Initial commit

  • Property mode set to 100644
File size: 1.2 KB
Line 
1package project.educatum.model.primarykeys;
2
3import lombok.Data;
4import org.hibernate.Hibernate;
5
6import javax.persistence.Column;
7import javax.persistence.Embeddable;
8import java.io.Serializable;
9import java.util.Objects;
10
11@Data
12@Embeddable
13public class TeacherStudentRelationID implements Serializable {
14
15 public TeacherStudentRelationID(Integer teacherID, Integer studentID) {
16 this.teacherID = teacherID;
17 this.studentID = studentID;
18 }
19
20 private static final long serialVersionUID = -3956016538071516037L;
21 @Column(name = "id_nastavnik", nullable = false)
22 private Integer teacherID;
23 @Column(name = "id_ucenik", nullable = false)
24 private Integer studentID;
25
26 public TeacherStudentRelationID() {
27 }
28
29 @Override
30 public int hashCode() {
31 return Objects.hash(teacherID, studentID);
32 }
33
34 @Override
35 public boolean equals(Object o) {
36 if (this == o) return true;
37 if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
38 TeacherStudentRelationID entity = (TeacherStudentRelationID) o;
39 return Objects.equals(this.teacherID, entity.teacherID) &&
40 Objects.equals(this.studentID, entity.studentID);
41 }
42}
Note: See TracBrowser for help on using the repository browser.