1 package myorg.relex.one2one;
2
3 import java.util.Date;
4
5 import javax.persistence.*;
6
7
8
9
10
11
12
13
14 @Entity
15 @Table(name="RELATIONEX_BOXOFFICE")
16 public class BoxOffice {
17 @EmbeddedId
18 private ShowEventPK pk;
19
20 @OneToOne(optional=false, fetch=FetchType.EAGER)
21 @MapsId
22 private ShowEvent show;
23
24 @Column(name="TICKETS")
25 private int ticketsLeft;
26
27 protected BoxOffice() {}
28 public BoxOffice(ShowEvent show) {
29 this.show = show;
30 }
31
32 public Date getDate() { return show==null ? null : show.getDate(); }
33 public Date getTime() { return show==null ? null : show.getTime(); }
34 public ShowEvent getShow() { return show; }
35
36 public int getTicketsLeft() { return ticketsLeft; }
37 public void setTicketsLeft(int ticketsLeft) {
38 this.ticketsLeft = ticketsLeft;
39 }
40 }