Hendrik Jungnitsch
2022-09-07 5092de6804da307d0d1a5f92d99b8f7a6f36a92b
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package de.gedoplan.seminar.jpa.exercise.domain;
 
import java.util.Objects;
 
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
 
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 
@Entity
@Table(name = Junction.TABLE_NAME)
public class Junction {
    
    public static final String TABLE_NAME = "JPA_JUNCTION";
 
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
 
    private String name;
 
    @Enumerated(EnumType.STRING)
    private JunctionKind kind;
 
    private String no;
    
    @JsonIgnoreProperties("junctions")
    @ManyToOne
    private Highway highway;
 
    public Junction() {
 
    }
 
    public Junction(String name, JunctionKind kind, String no) {
        this.name = name;
        this.kind = kind;
        this.no = no;
    }
 
    public Integer getId() {
        return id;
    }
 
    public void setId(Integer id) {
        this.id = id;
    }
 
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public JunctionKind getKind() {
        return kind;
    }
 
    public void setKind(JunctionKind kind) {
        this.kind = kind;
    }
 
    public String getNo() {
        return no;
    }
 
    public void setNo(String no) {
        this.no = no;
    }
    
 
    public Highway getHighway() {
        return highway;
    }
 
    public void setHighway(Highway highway) {
        this.highway = highway;
    }
 
    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
 
    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        Junction other = (Junction) obj;
        return Objects.equals(id, other.id);
    }
 
    @Override
    public String toString() {
        return "Junction [id=" + id + ", name=" + name + ", kind=" + kind + ", no=" + no + "]";
    }
 
}