1 package myorg.relex.one2one;
2
3 import javax.persistence.*;
4
5
6
7
8
9
10 @Entity
11 @Table(name="RELATIONEX_COACH")
12 public class Coach {
13 public enum Type {HEAD, ASSISTANT };
14 @Id
15 private int id;
16
17 @OneToOne(optional=false, fetch=FetchType.EAGER)
18 @MapsId
19 private Person person;
20
21 @Enumerated(EnumType.STRING) @Column(length=16)
22 private Type type;
23
24 public Coach() {}
25 public Coach(Person person) {
26 this.person = person;
27 }
28
29 public int getId() { return person==null ? 0 : person.getId(); }
30 public Person getPerson() { return person; }
31
32 public Type getType() { return type; }
33 public void setType(Type type) {
34 this.type = type;
35 }
36 }