KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > entity > customer > Customer


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: Customer.java 822 2006-07-04 14:35:35Z pinheirg $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.entity.customer;
26
27 import java.io.Serializable JavaDoc;
28 import java.util.List JavaDoc;
29
30 import javax.persistence.CascadeType;
31 import javax.persistence.Entity;
32 import javax.persistence.Id;
33 import javax.persistence.OneToMany;
34 import javax.persistence.OneToOne;
35
36 /**
37  * The customer.
38  * @author Gisele Pinheiro Souza
39  * @author Eduardo Studzinski Estima de Castro
40  *
41  */

42 @Entity
43 public class Customer implements Serializable JavaDoc{
44
45     /**
46      * The serial version.
47      */

48     private static final long serialVersionUID = -5935600735100590395L;
49
50     /**
51      * The customer id.
52      */

53     private long id;
54
55     /**
56      * The customer name.
57      */

58     private String JavaDoc name;
59
60     /**
61      * The orders.
62      */

63     private List JavaDoc<ProductOrder> orders;
64
65     /**
66      * The address.
67      */

68     private Address address;
69
70     /**
71      * Gets the customer address.
72      * @return the address.
73      */

74     @OneToOne(cascade = CascadeType.PERSIST)
75     public Address getAddress() {
76         return address;
77     }
78
79     /**
80      * Sets the customer address.
81      * @param address the new address.
82      */

83     public void setAddress(final Address address) {
84         this.address = address;
85     }
86
87     /**
88      * Gets the customer identifier.
89      * @return the identifier.
90      */

91     @Id
92     public long getId() {
93         return id;
94     }
95
96     /**
97      * Sets the customer identifier.
98      * @param id the customer identifier.
99      */

100     public void setId(final long id) {
101         this.id = id;
102     }
103
104     /**
105      * Gets the customer name.
106      * @return the name.
107      */

108     public String JavaDoc getName() {
109         return name;
110     }
111
112     /**
113      * Sets the customer name.
114      * @param name the new name.
115      */

116     public void setName(final String JavaDoc name) {
117         this.name = name;
118     }
119
120     /**
121      * Gets the client orders.
122      * @return the orders.
123      */

124     @OneToMany(cascade = CascadeType.MERGE)
125     public List JavaDoc<ProductOrder> getOrders() {
126         return orders;
127     }
128
129     /**
130      * Sets the orders.
131      * @param orders the list of orders.
132      */

133     public void setOrders(final List JavaDoc<ProductOrder> orders) {
134         this.orders = orders;
135     }
136
137 }
138
Popular Tags