KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > cmp2 > cmrtree > ejb > BBean


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.cmrtree.ejb;
23
24 import org.jboss.logging.Logger;
25
26 import javax.ejb.EntityBean JavaDoc;
27 import javax.ejb.EntityContext JavaDoc;
28 import javax.ejb.RemoveException JavaDoc;
29 import javax.ejb.CreateException JavaDoc;
30 import java.util.Collection JavaDoc;
31
32
33 /**
34  * @ejb.bean
35  * name="B"
36  * type="CMP"
37  * cmp-version="2.x"
38  * view-type="local"
39  * reentrant="false"
40  * @ejb.pk generate="true"
41  * @ejb.util generate="physical"
42  * @ejb.persistence table-name="CMRTREEB"
43  * @jboss.persistence
44  * create-table="true"
45  * remove-table="true"
46  * @ejb:transaction type="Required"
47  * @ jboss.container-configuration name="custom container"
48  *
49  * @author <a HREF="mailto:alex@jboss.org">Alexey Loubyansky</a>
50  * @version <tt>$Revision: 58115 $</tt>
51  */

52 public abstract class BBean
53    implements EntityBean JavaDoc
54 {
55    // Attributes -----------------------------------------------
56
Logger log = Logger.getLogger(BBean.class);
57    private EntityContext JavaDoc ctx;
58
59    // CMP accessors --------------------------------------------
60
/**
61     * @ejb.pk-field
62     * @ejb.persistent-field
63     * @ejb.interface-method
64     */

65    public abstract int getMajorId();
66
67    public abstract void setMajorId(int id);
68
69    /**
70     * @ejb.pk-field
71     * @ejb.persistent-field
72     * @ejb.interface-method
73     */

74    public abstract String JavaDoc getMinorId();
75
76    public abstract void setMinorId(String JavaDoc id);
77
78    /**
79     * @ejb.persistent-field
80     * @ejb.interface-method
81     */

82    public abstract String JavaDoc getName();
83
84    /**
85     * @ejb.interface-method
86     */

87    public abstract void setName(String JavaDoc id);
88
89    /**
90     * @ejb.persistent-field
91     * @ejb.interface-method
92     */

93    public abstract String JavaDoc getAMinorId();
94    /**
95     * @ejb.interface-method
96     */

97    public abstract void setAMinorId(String JavaDoc aid);
98
99    /**
100     * @ejb.persistent-field
101     * @ejb.interface-method
102     */

103    public abstract String JavaDoc getParentBMinorId();
104    /**
105     * @ejb.interface-method
106     */

107    public abstract void setParentBMinorId(String JavaDoc bid);
108
109    /**
110     * @ejb.interface-method
111     * @ejb.relation name="B-Children"
112     * role-name="B-has-children"
113     */

114    public abstract Collection JavaDoc getChildren();
115
116    /**
117     * @ejb.interface-method
118     */

119    public abstract void setChildren(Collection JavaDoc c);
120
121    /**
122     * @ejb.interface-method
123     * @ejb.relation
124     * name="B-Children"
125     * role-name="child-has-Parent"
126     * cascade-delete="true"
127     * @jboss.relation
128     * fk-constraint="false"
129     * related-pk-field="majorId"
130     * fk-column="majorId"
131     * @jboss.relation
132     * fk-constraint="false"
133     * related-pk-field="minorId"
134     * fk-column="parentBMinorId"
135     */

136    public abstract BLocal getParent();
137    /**
138     * @ejb.interface-method
139     */

140    public abstract void setParent(BLocal a);
141
142    /**
143     * @ejb.interface-method
144     * @ejb.relation
145     * name="A-B"
146     * role-name="B-has-A"
147     * cascade-delete="true"
148     * @jboss.relation
149     * fk-constraint="false"
150     * related-pk-field="majorId"
151     * fk-column="majorId"
152     * @jboss.relation
153     * fk-constraint="false"
154     * related-pk-field="minorId"
155     * fk-column="AMinorId"
156     */

157    public abstract ALocal getA();
158    /**
159     * @ejb.interface-method
160     */

161    public abstract void setA(ALocal a);
162
163    /**
164     * @ejb.create-method
165     * @throws CreateException
166     */

167    public BPK ejbCreate(int majorId, String JavaDoc minorId, String JavaDoc name)
168       throws CreateException JavaDoc
169    {
170       setMajorId(majorId);
171       setMinorId(minorId);
172       setName(name);
173       return null;
174    }
175
176    public void ejbPostCreate(int majorId, String JavaDoc minorId, String JavaDoc name)
177    {
178    }
179
180    /**
181     * @param ctx The new entityContext value
182     */

183    public void setEntityContext(EntityContext JavaDoc ctx)
184    {
185       this.ctx = ctx;
186    }
187
188    /**
189     * Unset the associated entity context.
190     */

191    public void unsetEntityContext()
192    {
193       this.ctx = null;
194    }
195
196    public void ejbActivate()
197    {
198    }
199
200    public void ejbLoad()
201    {
202    }
203
204    public void ejbPassivate()
205    {
206    }
207
208    public void ejbRemove() throws RemoveException JavaDoc
209    {
210    }
211
212    public void ejbStore()
213    {
214    }
215 }
216
Popular Tags