package de.gedoplan.seminar.jpa.exercise.domain;
|
|
import jakarta.persistence.Entity;
|
import jakarta.persistence.EnumType;
|
import jakarta.persistence.Enumerated;
|
import jakarta.persistence.ManyToOne;
|
import jakarta.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;
|
}
|
|
}
|