KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > tutorial > secondary > bean > Customer


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.tutorial.secondary.bean;
8
9 import javax.persistence.Column;
10 import javax.persistence.Entity;
11 import javax.persistence.GeneratorType;
12 import javax.persistence.Id;
13 import javax.persistence.JoinColumn;
14 import javax.persistence.SecondaryTable;
15 import javax.persistence.Table;
16
17 @Entity
18 @Table(name = "CUSTOMER")
19 @SecondaryTable(name = "EMBEDDED_ADDRESS")
20 @JoinColumn(name = "ADDRESS_ID")
21 public class Customer implements java.io.Serializable JavaDoc
22 {
23    private int id;
24    private String JavaDoc first;
25    private String JavaDoc last;
26    private String JavaDoc street;
27    private String JavaDoc city;
28    private String JavaDoc state;
29    private String JavaDoc zip;
30
31    public Customer()
32    {
33    }
34
35    public Customer(String JavaDoc first, String JavaDoc last, String JavaDoc street, String JavaDoc city, String JavaDoc state, String JavaDoc zip)
36    {
37       this.first = first;
38       this.last = last;
39       this.street = street;
40       this.city = city;
41       this.state = state;
42       this.zip = zip;
43    }
44
45    @Id(generate = GeneratorType.AUTO)
46    public int getId()
47    {
48       return id;
49    }
50
51    public void setId(int id)
52    {
53       this.id = id;
54    }
55
56    @Column(name = "FIRST")
57    public String JavaDoc getFirst()
58    {
59       return first;
60    }
61
62    public void setFirst(String JavaDoc first)
63    {
64       this.first = first;
65    }
66
67    @Column(name = "LAST")
68    public String JavaDoc getLast()
69    {
70       return last;
71    }
72
73    public void setLast(String JavaDoc last)
74    {
75       this.last = last;
76    }
77
78    @Column(name = "STREET", secondaryTable = "EMBEDDED_ADDRESS")
79    public String JavaDoc getStreet()
80    {
81       return street;
82    }
83
84    public void setStreet(String JavaDoc street)
85    {
86       this.street = street;
87    }
88
89    @Column(name = "CITY", secondaryTable = "EMBEDDED_ADDRESS")
90    public String JavaDoc getCity()
91    {
92       return city;
93    }
94
95    public void setCity(String JavaDoc city)
96    {
97       this.city = city;
98    }
99
100    @Column(name = "STATE", secondaryTable = "EMBEDDED_ADDRESS")
101    public String JavaDoc getState()
102    {
103       return state;
104    }
105
106    public void setState(String JavaDoc state)
107    {
108       this.state = state;
109    }
110
111    @Column(name = "ZIP", secondaryTable = "EMBEDDED_ADDRESS")
112    public String JavaDoc getZip()
113    {
114       return zip;
115    }
116
117    public void setZip(String JavaDoc zip)
118    {
119       this.zip = zip;
120    }
121 }
122
Popular Tags