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; } }