Hendrik Jungnitsch
2022-09-07 ba63e9aac75a3e8e59ba00dc2a03bdf0a9433cd2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package de.gedoplan.seminar.jpa.exercise.domain;
 
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
 
import de.gedoplan.seminar.jpa.exercise.common.GeneratedIntegerIdEntity;
 
@Entity
@Table(name = TrafficJam.TABLE_NAME)
public class TrafficJam extends GeneratedIntegerIdEntity {
    public static final String TABLE_NAME = "JPA_TRAFFIC_JAM";
 
    @ManyToOne
    private Junction start;
 
    @ManyToOne
    private Junction end;
 
    private int length;
 
    @Enumerated(EnumType.STRING)
    private TrafficJamKind kind;
 
    @Enumerated(EnumType.STRING)
    private TrafficJamCause cause;
 
    protected TrafficJam() {
    }
 
    public TrafficJam(Junction start, Junction end, int length, TrafficJamKind kind, TrafficJamCause cause) {
        this.start = start;
        this.end = end;
        this.length = length;
        this.cause = cause;
        this.kind = kind;
    }
 
    public Junction getStart() {
        return this.start;
    }
 
    public Junction getEnd() {
        return this.end;
    }
 
    public int getLength() {
        return this.length;
    }
 
    public TrafficJamKind getKind() {
        return this.kind;
    }
 
    public TrafficJamCause getCause() {
        return this.cause;
    }
 
}