KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > test > annotations > onetoone > Client


1 //$Id: Client.java,v 1.1 2005/05/12 13:33:34 epbernard Exp $
2
package org.hibernate.test.annotations.onetoone;
3
4 import javax.persistence.CascadeType;
5 import javax.persistence.Entity;
6 import javax.persistence.GeneratorType;
7 import javax.persistence.Id;
8 import javax.persistence.JoinColumn;
9 import javax.persistence.OneToOne;
10
11 /**
12  * @author Emmanuel Bernard
13  */

14 @Entity
15 public class Client {
16
17     private Integer JavaDoc id;
18     private String JavaDoc name;
19     private Address address;
20
21     @OneToOne(cascade = CascadeType.ALL)
22     @JoinColumn(name="ADDRESS_ID")
23     public Address getAddress() {
24         return address;
25     }
26
27     public void setAddress(Address address) {
28         this.address = address;
29     }
30
31     @Id(generate = GeneratorType.AUTO)
32     public Integer JavaDoc getId() {
33         return id;
34     }
35
36     public void setId(Integer JavaDoc id) {
37         this.id = id;
38     }
39
40     public String JavaDoc getName() {
41         return name;
42     }
43
44     public void setName(String JavaDoc name) {
45         this.name = name;
46     }
47
48 }
49
Popular Tags