KickJava   Java API By Example, From Geeks To Geeks.

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


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: Product.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
29 import javax.persistence.CascadeType;
30 import javax.persistence.Entity;
31 import javax.persistence.Id;
32 import javax.persistence.ManyToOne;
33
34 /**
35  * The product.
36  * @author Gisele Pinheiro Souza
37  * @author Eduardo Studzinski Estima de Castro
38  *
39  */

40 @Entity
41 public class Product implements Serializable JavaDoc {
42
43     /**
44      * The serial version.
45      */

46     private static final long serialVersionUID = 2265810991046125943L;
47
48     /**
49      * The product identifier.
50      */

51     private long id;
52
53     /**
54      * The product description.
55      */

56     private String JavaDoc description;
57
58     /**
59      * The product price.
60      */

61     private float price;
62
63     /**
64      * The product category.
65      */

66     private Category category;
67
68     /**
69      * The order that hasthis product.
70      */

71     private ProductOrder order;
72
73     /**
74      * Creates a new instance of Product.
75      * @param id the identifier.
76      * @param description the product description.
77      * @param price the product price.
78      * @param category the product category.
79      * @param order the order that has this product.
80      */

81     public Product(final long id, final String JavaDoc description, final float price, final Category category,
82             final ProductOrder order) {
83         this.id = id;
84         this.description = description;
85         this.price = price;
86         this.category = category;
87         this.order = order;
88     }
89
90     /**
91      * Creates a new instance of Product.
92      * @param id the identifier.
93      * @param description the product description.
94      * @param price the product price.
95      * @param category the product category.
96      */

97     public Product(final long id, final String JavaDoc description, final float price, final Category category) {
98         this.id = id;
99         this.description = description;
100         this.price = price;
101         this.category = category;
102     }
103
104     /**
105      * Creates a new instance of Product.
106      *
107      */

108     public Product() {
109
110     }
111
112     /**
113      * Gets the order.
114      * @return the order.
115      */

116     @ManyToOne
117     public ProductOrder getOrder() {
118         return order;
119     }
120
121     /**
122      * Sets the order.
123      * @param order the order that has this product.
124      */

125     public void setOrder(final ProductOrder order) {
126         this.order = order;
127     }
128
129     /**
130      * Gets the product description.
131      * @return the description.
132      */

133     public String JavaDoc getDescription() {
134         return description;
135     }
136
137     /**
138      * Sets the product description.
139      * @param description the product description.
140      */

141     public void setDescription(final String JavaDoc description) {
142         this.description = description;
143     }
144
145     /**
146      * Gets the product identifier.
147      * @return the identifier.
148      */

149     @Id
150     public long getId() {
151         return id;
152     }
153
154     /**
155      * Sets the product identifier.
156      * @param id the identifier.
157      */

158     public void setId(final long id) {
159         this.id = id;
160     }
161
162     /**
163      * Gets the product price.
164      * @return the price.
165      */

166     public float getPrice() {
167         return price;
168     }
169
170     /**
171      * Sets the product price.
172      * @param price the product price.
173      */

174     public void setPrice(final float price) {
175         this.price = price;
176     }
177
178     /**
179      * Gets the product category.
180      * @return the category.
181      */

182     @ManyToOne(cascade = CascadeType.REFRESH)
183     public Category getCategory() {
184         return category;
185     }
186
187     /**
188      * Sets the product category.
189      * @param category the new category.
190      */

191     public void setCategory(final Category category) {
192         this.category = category;
193     }
194
195 }
196
Popular Tags