KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > cmp2 > optimisticlock > ejb > CmpEntityBean


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.test.cmp2.optimisticlock.ejb;
23
24 import javax.ejb.EntityBean JavaDoc;
25 import javax.ejb.CreateException JavaDoc;
26 import javax.ejb.RemoveException JavaDoc;
27 import javax.ejb.EntityContext JavaDoc;
28
29 /**
30  * @ejb.bean
31  * name="CmpEntity"
32  * local-jndi-name="local/CmpEntityBean"
33  * view-type="local"
34  * type="CMP"
35  * reentrant="false"
36  * cmp-version="2.x"
37  * primkey-field="id"
38  *
39  * @jboss.create-table "true"
40  * @jboss.remove-table "false"
41  *
42  * @ejb.finder
43  * signature="CmpEntityLocal findById(java.lang.Integer id)"
44  * query="select object(o) from CmpEntity o where o.id=?1"
45  *
46  * @author <a HREF="mailto:aloubyansky@hotmail.com">Alex Loubyansky</a>
47  */

48 public abstract class CmpEntityBean
49    implements EntityBean JavaDoc
50 {
51    // Attributes ----------------------------------------
52
private EntityContext JavaDoc ctx;
53
54    // CMP accessors -------------------------------------
55
/**
56     * @ejb.pk-field
57     * @ejb.persistent-field
58     * @ejb.interface-method
59     */

60    public abstract Integer JavaDoc getId();
61    public abstract void setId(Integer JavaDoc id);
62
63    /**
64     * @ejb.persistent-field
65     * @ejb.interface-method
66     */

67    public abstract String JavaDoc getStringGroup1();
68    /**
69     * @ejb.interface-method
70     */

71    public abstract void setStringGroup1(String JavaDoc stringField);
72
73    /**
74     * @ejb.persistent-field
75     * @ejb.interface-method
76     */

77    public abstract Integer JavaDoc getIntegerGroup1();
78    /**
79     * @ejb.interface-method
80     */

81    public abstract void setIntegerGroup1(Integer JavaDoc value);
82
83    /**
84     * @ejb.persistent-field
85     * @ejb.interface-method
86     */

87    public abstract Double JavaDoc getDoubleGroup1();
88    /**
89     * @ejb.interface-method
90     */

91    public abstract void setDoubleGroup1(Double JavaDoc value);
92
93    /**
94     * @ejb.persistent-field
95     * @ejb.interface-method
96     */

97    public abstract String JavaDoc getStringGroup2();
98    /**
99     * @ejb.interface-method
100     */

101    public abstract void setStringGroup2(String JavaDoc stringField);
102
103    /**
104     * @ejb.persistent-field
105     * @ejb.interface-method
106     */

107    public abstract Integer JavaDoc getIntegerGroup2();
108    /**
109     * @ejb.interface-method
110     */

111    public abstract void setIntegerGroup2(Integer JavaDoc value);
112
113    /**
114     * @ejb.persistent-field
115     * @ejb.interface-method
116     */

117    public abstract Double JavaDoc getDoubleGroup2();
118    /**
119     * @ejb.interface-method
120     */

121    public abstract void setDoubleGroup2(Double JavaDoc value);
122
123    /**
124     * @ejb.persistent-field
125     * @ejb.interface-method
126     */

127    public abstract Long JavaDoc getVersionField();
128    /**
129     * @ejb.interface-method
130     */

131    public abstract void setVersionField(Long JavaDoc value);
132
133    // EntityBean implementation -------------------------
134
/**
135     * @ejb.create-method
136     */

137    public Integer JavaDoc ejbCreate(Integer JavaDoc id,
138                             String JavaDoc stringGroup1,
139                             Integer JavaDoc integerGroup1,
140                             Double JavaDoc doubleGroup1,
141                             String JavaDoc stringGroup2,
142                             Integer JavaDoc integerGroup2,
143                             Double JavaDoc doubleGroup2)
144       throws CreateException JavaDoc
145    {
146       setId(id);
147       setStringGroup1(stringGroup1);
148       setIntegerGroup1(integerGroup1);
149       setDoubleGroup1(doubleGroup1);
150       setStringGroup2(stringGroup2);
151       setIntegerGroup2(integerGroup2);
152       setDoubleGroup2(doubleGroup2);
153       return null;
154    }
155
156    public void ejbPostCreate(Integer JavaDoc id,
157                              String JavaDoc stringGroup1,
158                              Integer JavaDoc integerGroup1,
159                              Double JavaDoc doubleGroup1,
160                              String JavaDoc stringGroup2,
161                              Integer JavaDoc integerGroup2,
162                              Double JavaDoc doubleGroup2) {}
163
164    public void ejbRemove() throws RemoveException JavaDoc
165    {}
166
167    public void setEntityContext(EntityContext JavaDoc ctx)
168    {
169       this.ctx = ctx;
170    }
171
172    public void unsetEntityContext()
173    {
174       this.ctx = null;
175    }
176
177    public void ejbActivate() {}
178    public void ejbPassivate() {}
179    public void ejbLoad() {}
180    public void ejbStore() {}
181 }
182
Popular Tags