1 package myorg.relex.one2many;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import javax.persistence.*;
7
8
9
10
11
12
13 @Entity
14 @Table(name="RELATIONEX_ROUTE")
15 public class Route {
16 @Id
17 private int number;
18
19 @OneToMany
20 @JoinColumn
21 private List<Stop> stops;
22
23 protected Route() {}
24 public Route(int number) {
25 this.number = number;
26 }
27
28 public int getNumber() { return number; }
29
30 public List<Stop> getStops() {
31 if (stops == null) { stops = new ArrayList<Stop>(); }
32 return stops;
33 }
34 public void setStops(List<Stop> stops) {
35 this.stops = stops;
36 }
37 }