/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/LecturePK.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 lecture database table.
 
8
 * 
 
9
 */
 
10
@Embeddable
 
11
public class LecturePK implements Serializable {
 
12
        //default serial version id, required for serializable classes.
 
13
        private static final long serialVersionUID = 1L;
 
14
        private Long course;
 
15
        private java.util.Date startTime;
 
16
        private java.util.Date endTime;
 
17
 
 
18
        public LecturePK() {
 
19
        }
 
20
 
 
21
        @Column(insertable=false, updatable=false, unique=true, nullable=false)
 
22
        public Long getCourse() {
 
23
                return this.course;
 
24
        }
 
25
        public void setCourse(Long course) {
 
26
                this.course = course;
 
27
        }
 
28
 
 
29
        @Temporal(TemporalType.TIMESTAMP)
 
30
        @Column(name="start_time", unique=true, nullable=false)
 
31
        public java.util.Date getStartTime() {
 
32
                return this.startTime;
 
33
        }
 
34
        public void setStartTime(java.util.Date startTime) {
 
35
                this.startTime = startTime;
 
36
        }
 
37
 
 
38
        @Temporal(TemporalType.TIMESTAMP)
 
39
        @Column(name="end_time", unique=true, nullable=false)
 
40
        public java.util.Date getEndTime() {
 
41
                return this.endTime;
 
42
        }
 
43
        public void setEndTime(java.util.Date endTime) {
 
44
                this.endTime = endTime;
 
45
        }
 
46
 
 
47
        public boolean equals(Object other) {
 
48
                if (this == other) {
 
49
                        return true;
 
50
                }
 
51
                if (!(other instanceof LecturePK)) {
 
52
                        return false;
 
53
                }
 
54
                LecturePK castOther = (LecturePK)other;
 
55
                return 
 
56
                        this.course.equals(castOther.course)
 
57
                        && this.startTime.equals(castOther.startTime)
 
58
                        && this.endTime.equals(castOther.endTime);
 
59
        }
 
60
 
 
61
        public int hashCode() {
 
62
                final int prime = 31;
 
63
                int hash = 17;
 
64
                hash = hash * prime + this.course.hashCode();
 
65
                hash = hash * prime + this.startTime.hashCode();
 
66
                hash = hash * prime + this.endTime.hashCode();
 
67
                
 
68
                return hash;
 
69
        }
 
70
}
 
 
b'\\ No newline at end of file'