source: src/main/java/project/educatum/model/primarykeys/InterestID.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.1 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 InterestID implements Serializable {
14
15 private static final long serialVersionUID = 1443493244068543984L;
16 @Column(name = "id_ucenik", nullable = false)
17 private Integer studentID;
18 @Column(name = "id_predmet", nullable = false)
19 private Integer subjectID;
20
21 public InterestID(Integer subjectID, Integer ucenikId) {
22 this.subjectID = subjectID;
23 this.studentID = ucenikId;
24 }
25
26 public InterestID() {
27
28 }
29
30 @Override
31 public int hashCode() {
32 return Objects.hash(subjectID, studentID);
33 }
34
35 @Override
36 public boolean equals(Object o) {
37 if (this == o) return true;
38 if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
39 InterestID entity = (InterestID) o;
40 return Objects.equals(this.subjectID, entity.subjectID) &&
41 Objects.equals(this.studentID, entity.studentID);
42 }
43}
Note: See TracBrowser for help on using the repository browser.