1 package myorg.relex.one2one;
2
3 import javax.persistence.*;
4
5
6
7
8
9 @Entity
10 @Table(name="RELATIONEX_DRIVER2")
11 public class Driver2 {
12 @Id @GeneratedValue
13 private int id;
14 @Column(length=20)
15 private String name;
16
17 @OneToOne(mappedBy="driver",
18 optional=false,
19 fetch=FetchType.EAGER)
20 private Auto2 auto;
21
22 protected Driver2() {}
23 public Driver2(Auto2 auto) {
24 this.auto = auto;
25 }
26
27 public int getId() { return id; }
28
29 public Auto2 getAuto() { return auto; }
30 public void setAuto(Auto2 auto) {
31 this.auto = auto;
32 }
33
34 public String getName() { return name; }
35 public void setName(String name) {
36 this.name = name;
37 }
38 }