source: src/main/java/project/educatum/model/primarykeys/TeacherSubjectRelationID.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 TeacherSubjectRelationID implements Serializable {
14 private static final long serialVersionUID = -3195641753836744763L;
15 @Column(name = "id_nastavnik", nullable = false)
16 private Integer teacherID;
17 @Column(name = "id_predmet", nullable = false)
18 private Integer subjectID;
19
20 public TeacherSubjectRelationID(Integer teacherID, Integer subjectID) {
21 this.teacherID = teacherID;
22 this.subjectID = subjectID;
23 }
24
25 public TeacherSubjectRelationID() {
26
27 }
28
29 @Override
30 public int hashCode() {
31 return Objects.hash(subjectID, teacherID);
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 TeacherSubjectRelationID entity = (TeacherSubjectRelationID) o;
39 return Objects.equals(this.subjectID, entity.subjectID) &&
40 Objects.equals(this.teacherID, entity.teacherID);
41 }
42}
Note: See TracBrowser for help on using the repository browser.