/magstudentportal/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/magstudentportal/trunk

« back to all changes in this revision

Viewing changes to src/main/java/DB/TeachPK.java

  • Committer: Gustav Hartvigsson
  • Date: 2017-08-28 14:00:50 UTC
  • mfrom: (15.1.3 magstudentportal-more-db)
  • Revision ID: gustav.hartvigsson@gmail.com-20170828140050-zu6nqc1vlp9wnwh8
* derp?

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package DB;
 
2
 
 
3
import java.io.Serializable;
 
4
import javax.persistence.*;
 
5
 
 
6
/**
 
7
 * The primary key class for the teaches database table.
 
8
 * 
 
9
 */
 
10
@Embeddable
 
11
public class TeachPK implements Serializable {
 
12
        //default serial version id, required for serializable classes.
 
13
        private static final long serialVersionUID = 1L;
 
14
        private Long course;
 
15
        private Long staff;
 
16
 
 
17
        public TeachPK() {
 
18
        }
 
19
 
 
20
        @Column(insertable=false, updatable=false, unique=true, nullable=false)
 
21
        public Long getCourse() {
 
22
                return this.course;
 
23
        }
 
24
        public void setCourse(Long course) {
 
25
                this.course = course;
 
26
        }
 
27
 
 
28
        @Column(insertable=false, updatable=false, unique=true, nullable=false)
 
29
        public Long getStaff() {
 
30
                return this.staff;
 
31
        }
 
32
        public void setStaff(Long staff) {
 
33
                this.staff = staff;
 
34
        }
 
35
 
 
36
        public boolean equals(Object other) {
 
37
                if (this == other) {
 
38
                        return true;
 
39
                }
 
40
                if (!(other instanceof TeachPK)) {
 
41
                        return false;
 
42
                }
 
43
                TeachPK castOther = (TeachPK)other;
 
44
                return 
 
45
                        this.course.equals(castOther.course)
 
46
                        && this.staff.equals(castOther.staff);
 
47
        }
 
48
 
 
49
        public int hashCode() {
 
50
                final int prime = 31;
 
51
                int hash = 17;
 
52
                hash = hash * prime + this.course.hashCode();
 
53
                hash = hash * prime + this.staff.hashCode();
 
54
                
 
55
                return hash;
 
56
        }
 
57
}
 
 
b'\\ No newline at end of file'