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.0 KB
|
Rev | Line | |
---|
[d3cf3a1] | 1 | package project.educatum.model.primarykeys;
|
---|
| 2 |
|
---|
| 3 | import lombok.Data;
|
---|
| 4 | import org.hibernate.Hibernate;
|
---|
| 5 |
|
---|
| 6 | import javax.persistence.Column;
|
---|
| 7 | import javax.persistence.Embeddable;
|
---|
| 8 | import java.io.Serializable;
|
---|
| 9 | import java.util.Objects;
|
---|
| 10 |
|
---|
| 11 | @Data
|
---|
| 12 | @Embeddable
|
---|
| 13 | public class StudentHomeworkRelationID implements Serializable {
|
---|
| 14 |
|
---|
| 15 | private static final long serialVersionUID = 8560838741150170862L;
|
---|
| 16 | @Column(name = "id_ucenik", nullable = false)
|
---|
| 17 | private Integer studentID;
|
---|
| 18 | @Column(name = "id_domasno", nullable = false)
|
---|
| 19 | private Integer homeworkID;
|
---|
| 20 |
|
---|
| 21 | @Override
|
---|
| 22 | public int hashCode() {
|
---|
| 23 | return Objects.hash(homeworkID, studentID);
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | @Override
|
---|
| 27 | public boolean equals(Object o) {
|
---|
| 28 | if (this == o) return true;
|
---|
| 29 | if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
---|
| 30 | StudentHomeworkRelationID entity = (StudentHomeworkRelationID) o;
|
---|
| 31 | return Objects.equals(this.homeworkID, entity.homeworkID) &&
|
---|
| 32 | Objects.equals(this.studentID, entity.studentID);
|
---|
| 33 | }
|
---|
| 34 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.