package de.gedoplan.seminar.jpa.exercise.domain;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
import jakarta.persistence.Entity;
|
import jakarta.persistence.Id;
|
import jakarta.persistence.OneToMany;
|
import jakarta.persistence.Table;
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
@Entity
|
@Table(name = Highway.TABLE_NAME)
|
public class Highway {
|
|
public static final String TABLE_NAME = "JPA_HIGHWAY";
|
|
@Id
|
private int id;
|
private String name;
|
private String origin;
|
private String destination;
|
|
@JsonIgnoreProperties("highway")
|
@OneToMany(mappedBy = "highway")
|
private List<Junction> junctions = new ArrayList<>();
|
|
public Highway() {
|
}
|
|
public Highway(int id, String name, String origin, String destination) {
|
this.id = id;
|
this.name = name;
|
this.origin = origin;
|
this.destination = destination;
|
}
|
|
public int getId() {
|
return this.id;
|
}
|
|
public void setId(int id) {
|
this.id = id;
|
}
|
|
public void setName(String name) {
|
this.name = name;
|
}
|
|
public void setOrigin(String origin) {
|
this.origin = origin;
|
}
|
|
public void setDestination(String destination) {
|
this.destination = destination;
|
}
|
|
public String getName() {
|
return this.name;
|
}
|
|
public String getOrigin() {
|
return this.origin;
|
}
|
|
public String getDestination() {
|
return this.destination;
|
}
|
|
|
public List<Junction> getJunctions() {
|
return junctions;
|
}
|
|
@Override
|
public String toString() {
|
return "Highway [id=" + id + ", name=" + name + ", origin=" + origin + ", destination=" + destination + "]";
|
}
|
|
}
|