KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > ejb > AllTypesEntityBean


1
2 package test.ejb;
3
4 import test.interfaces.AllTypesEntityUtil;
5
6 import javax.ejb.EntityBean JavaDoc;
7 import javax.ejb.EntityContext JavaDoc;
8 import javax.ejb.CreateException JavaDoc;
9 import javax.ejb.RemoveException JavaDoc;
10 import java.rmi.RemoteException JavaDoc;
11 import java.util.Date JavaDoc;
12
13 /**
14  * This bean demonstrates all possible data types.
15  *
16  * @ejb.bean name="AllTypesEntity"
17  * jndi-name="test/AllTypesEntity"
18  * local-jndi-name="test/LocalAllTypesEntity"
19  * view-type="both"
20  *
21  *
22  * @ejb.persistence
23  * table-name="alltypes"
24  *
25  * @ejb.pk unchecked="true"
26  * @version $Revision: 1.7 $
27  * @author <a HREF="mailto:youremail@yourdomain.com">youremail@yourdomain.com</a>
28  */

29 public abstract class AllTypesEntityBean extends BaseEntityBean implements EntityBean JavaDoc {
30     /** @ejb.create-method */
31     public String JavaDoc ejbCreate(boolean aBoolean, byte aByte, short aShort, char aChar, int anInt) throws CreateException JavaDoc {
32         // set the primary key
33
setId(AllTypesEntityUtil.generateGUID(this));
34
35         setABoolean(aBoolean);
36         setAByte(aByte);
37         setAShort(aShort);
38         setAChar(aChar);
39         setAnInt(anInt);
40
41         return null;
42     }
43
44     public void ejbPostCreate(boolean aBoolean, byte aByte, short aShort, char aChar, int anInt) throws CreateException JavaDoc {
45     }
46    /**
47     * @ejb.persistent-field
48     * @ejb.interface-method
49     * @ejb.pk-field
50     */

51    public abstract int[] getIVOwnerHdl();
52    public abstract void setVOwnerHdl(int[] bb);
53     /**
54      * @ejb.pk-field
55      * @ejb.interface-method
56      * @ejb.persistent-field
57      *
58      * @ejb.persistence column-name="types_id"
59      */

60     public abstract String JavaDoc getId();
61
62     /**
63      * No interface method for setId(..). See page 130 of the EJB 2.0 specification:
64      * "Once the primary key for an entity bean has been set, the Bean Provider must
65      * not attempt to change it by use of set accessor methods on the primary key
66      * cmp-fields. The Bean provider should therefore not expose the set accessor
67      * methods for the primary key cmp-fields in the component interface of the
68      * entity bean.". A work around would be to remove and then an re-create the bean.
69      */

70     public abstract void setId(String JavaDoc id);
71
72     /**
73      * Abstract CMP 2.0 field getter for field aBoolean.
74      *
75      * @ejb.interface-method
76      * @ejb.persistent-field
77      *
78      * @ejb.persistence column-name="boolean"
79      */

80     public abstract boolean getABoolean();
81
82     /**
83      * Abstract CMP 2.0 field setter for field aBoolean.
84      *
85      * @ejb.interface-method
86      */

87     public abstract void setABoolean(boolean aBoolean);
88
89     /**
90      * Abstract CMP 2.0 field getter for field aByte.
91      *
92      * @ejb.interface-method
93      * @ejb.persistent-field
94      *
95      * @ejb.persistence column-name="byte"
96      */

97     public abstract byte getAByte();
98
99     /**
100      * Abstract CMP 2.0 field setter for field aByte.
101      *
102      * @ejb.interface-method
103      */

104     public abstract void setAByte(byte aByte);
105
106     /**
107      * Abstract CMP 2.0 field getter for field aShort.
108      *
109      * @ejb.interface-method
110      * @ejb.persistent-field
111      *
112      * @ejb.persistence column-name="short"
113      */

114     public abstract short getAShort();
115
116     /**
117      * Abstract CMP 2.0 field setter for field aShort.
118      *
119      * @ejb.interface-method
120      */

121     public abstract void setAShort(short aShort);
122
123     /**
124      * Abstract CMP 2.0 field getter for field aChar.
125      *
126      * @ejb.interface-method
127      * @ejb.persistent-field
128      *
129      * @ejb.persistence column-name="char"
130      */

131     public abstract char getAChar();
132
133     /**
134      * Abstract CMP 2.0 field setter for field aChar.
135      *
136      * @ejb.interface-method
137      */

138     public abstract void setAChar(char aChar);
139
140     /**
141      * Abstract CMP 2.0 field getter for field anInt.
142      *
143      * @ejb.interface-method
144      * @ejb.persistent-field
145      *
146      * @ejb.persistence column-name="int"
147      */

148     public abstract int getAnInt();
149
150     /**
151      * Abstract CMP 2.0 field setter for field anInt.
152      *
153      * @ejb.interface-method
154      */

155     public abstract void setAnInt(int anInt);
156
157     /**
158      * Abstract CMP 2.0 field getter for field aLong.
159      *
160      * @ejb.interface-method
161      * @ejb.persistent-field
162      *
163      * @ejb.persistence column-name="long"
164      */

165     public abstract long getALong();
166
167     /**
168      * Abstract CMP 2.0 field setter for field aLong.
169      *
170      * @ejb.interface-method
171      */

172     public abstract void setALong(long aLong);
173
174     /**
175      * Abstract CMP 2.0 field getter for field aFloat.
176      *
177      * @ejb.interface-method
178      * @ejb.persistent-field
179      *
180      * @ejb.persistence column-name="float"
181      */

182     public abstract float getAFloat();
183
184     /**
185      * Abstract CMP 2.0 field setter for field aFloat.
186      *
187      * @ejb.interface-method
188      */

189     public abstract void setAFloat(float aFloat);
190
191     /**
192      * Abstract CMP 2.0 field getter for field aDouble.
193      *
194      * @ejb.interface-method
195      * @ejb.persistent-field
196      *
197      * @ejb.persistence column-name="double"
198      */

199     public abstract double getADouble();
200
201     /**
202      * Abstract CMP 2.0 field setter for field aDouble.
203      *
204      * @ejb.interface-method
205      */

206     public abstract void setADouble(double aDouble);
207
208     /**
209      * Abstract CMP 2.0 field getter for field anObject.
210      * NOTE: most CMP engines will store the Object class as a serialized
211      * object in a BLOB data type.
212      *
213      * @ejb.interface-method
214      * @ejb.persistent-field
215      *
216      * @ejb.persistence column-name="object"
217      */

218     public abstract Object JavaDoc getAnObject();
219
220     /**
221      * Abstract CMP 2.0 field setter for field anObject.
222      *
223      * @ejb.interface-method
224      */

225     public abstract void setAnObject(Object JavaDoc anObject);
226
227     /**
228      * Abstract CMP 2.0 field getter for field anObjectArray.
229      *
230      * @ejb.interface-method
231      * @ejb.persistent-field
232      *
233      * @ejb.persistence column-name="objectArray"
234      */

235     public abstract Object JavaDoc[] getAnObjectArray();
236
237     /**
238      * Abstract CMP 2.0 field setter for field anObjectArray.
239      *
240      * @ejb.interface-method
241      */

242     public abstract void setAnObjectArray(Object JavaDoc[] anObjectArray);
243
244     /**
245      * Abstract CMP 2.0 field getter for field aBooleanArray.
246      *
247      * @ejb.interface-method
248      * @ejb.persistent-field
249      *
250      * @ejb.persistence column-name="booleanArray"
251      */

252     public abstract boolean[] getABooleanArray();
253
254     /**
255      * Abstract CMP 2.0 field setter for field aBooleanArray.
256      *
257      * @ejb.interface-method
258      */

259     public abstract void setABooleanArray(boolean[] aBooleanArray);
260
261     /**
262      * Abstract CMP 2.0 field getter for field aByteArray.
263      *
264      * @ejb.interface-method
265      * @ejb.persistent-field
266      *
267      * @ejb.persistence column-name="byteArray"
268      */

269     public abstract byte[] getAByteArray();
270
271     /**
272      * Abstract CMP 2.0 field setter for field aByteArray.
273      *
274      * @ejb.interface-method
275      */

276     public abstract void setAByteArray(byte[] aByteArray);
277
278     /**
279      * Abstract CMP 2.0 field getter for field aCharArray.
280      *
281      * @ejb.interface-method
282      * @ejb.persistent-field
283      *
284      * @ejb.persistence column-name="charArray"
285      */

286     public abstract char[] getACharArray();
287
288     /**
289      * Abstract CMP 2.0 field setter for field aCharArray.
290      *
291      * @ejb.interface-method
292      */

293     public abstract void setACharArray(char[] aCharArray);
294
295     /**
296      * Abstract CMP 2.0 field getter for field aShortArray.
297      *
298      * @ejb.interface-method
299      * @ejb.persistent-field
300      *
301      * @ejb.persistence column-name="shortArray"
302      */

303     public abstract short[] getAShortArray();
304
305     /**
306      * Abstract CMP 2.0 field setter for field aShortArray.
307      *
308      * @ejb.interface-method
309      */

310     public abstract void setAShortArray(short[] aShortArray);
311
312     /**
313      * Abstract CMP 2.0 field getter for field anIntArray.
314      *
315      * @ejb.interface-method
316      * @ejb.persistent-field
317      *
318      * @ejb.persistence column-name="intArray"
319      */

320     public abstract int[] getAnIntArray();
321
322     /**
323      * Abstract CMP 2.0 field setter for field anIntArray.
324      *
325      * @ejb.interface-method
326      */

327     public abstract void setAnIntArray(int[] anIntArray);
328
329     /**
330      * Abstract CMP 2.0 field getter for field aLongArray.
331      *
332      * @ejb.interface-method
333      * @ejb.persistent-field
334      *
335      * @ejb.persistence column-name="longArray"
336      */

337     public abstract long[] getALongArray();
338
339     /**
340      * Abstract CMP 2.0 field setter for field aLongArray.
341      *
342      * @ejb.interface-method
343      */

344     public abstract void setALongArray(long[] aLongArray);
345
346     /**
347      * Abstract CMP 2.0 field getter for field aFloatArray.
348      *
349      * @ejb.interface-method
350      * @ejb.persistent-field
351      *
352      * @ejb.persistence column-name="floatArray"
353      */

354     public abstract float[] getAFloatArray();
355
356     /**
357      * Abstract CMP 2.0 field setter for field aFloatArray.
358      *
359      * @ejb.interface-method
360      */

361     public abstract void setAFloatArray(float[] aFloatArray);
362
363     /**
364      * Abstract CMP 2.0 field getter for field aDoubleArray.
365      *
366      * @ejb.interface-method
367      * @ejb.persistent-field
368      *
369      * @ejb.persistence column-name="doubleArray"
370      */

371     public abstract double[] getADoubleArray();
372
373     /**
374      * Abstract CMP 2.0 field setter for field aDoubleArray.
375      *
376      * @ejb.interface-method
377      */

378     public abstract void setADoubleArray(double[] aDoubleArray);
379 }
Popular Tags