1 package myorg.relex.one2one;
2
3 import javax.persistence.*;
4
5
6
7
8
9
10 @Entity
11 @Table(name="RELATIONEX_PASSENGER")
12 public class Passenger {
13 @Id @GeneratedValue
14 private int id;
15
16 @OneToOne(optional=false)
17 private Ticket ticket;
18
19 @Column(length=32, nullable=false)
20 private String name;
21
22 protected Passenger() {}
23 public Passenger(int id) { this.id = id; }
24 public Passenger(Ticket ticket, String name) {
25 this.ticket = ticket;
26 this.name = name;
27 }
28
29 public int getId() { return id; }
30
31 public Ticket getTicket() { return ticket; }
32 public void setTicket(Ticket ticket) {
33 this.ticket = ticket;
34 }
35
36 public String getName() { return name;}
37 public void setName(String name) {
38 this.name = name;
39 }
40 }