KickJava   Java API By Example, From Geeks To Geeks.

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


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 name="A"
35  * type="CMP"
36  * cmp-version="2.x"
37  * view-type="local"
38  * reentrant="false"
39  * @ejb.pk generate="true"
40  * @ejb.util generate="physical"
41  * @ejb.persistence table-name="CMRTREEA"
42  * @jboss.persistence
43  * create-table="true"
44  * remove-table="true"
45  * @ejb:transaction type="Required"
46  * @ jboss.container-configuration name="custom container"
47  *
48  * @author <a HREF="mailto:alex@jboss.org">Alexey Loubyansky</a>
49  * @version <tt>$Revision: 58115 $</tt>
50  */

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

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

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

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

85    public abstract void setName(String JavaDoc name);
86
87    /**
88     * @ejb.interface-method
89     * @ejb.relation name="A-B"
90     * role-name="A-has-B"
91     */

92    public abstract Collection JavaDoc getB();
93
94    /**
95     * @ejb.interface-method
96     */

97    public abstract void setB(Collection JavaDoc c);
98
99    /**
100     * @throws javax.ejb.CreateException
101     * @ejb.create-method
102     */

103    public APK ejbCreate(int id, String JavaDoc id2, String JavaDoc name)
104       throws CreateException JavaDoc
105    {
106       setMajorId(id);
107       setMinorId(id2);
108       setName(name);
109       return null;
110    }
111
112    public void ejbPostCreate(int id, String JavaDoc id2, String JavaDoc name)
113    {
114    }
115
116    /**
117     * @param ctx The new entityContext value
118     */

119    public void setEntityContext(EntityContext JavaDoc ctx)
120    {
121       this.ctx = ctx;
122    }
123
124    /**
125     * Unset the associated entity context.
126     */

127    public void unsetEntityContext()
128    {
129       this.ctx = null;
130    }
131
132    public void ejbActivate()
133    {
134    }
135
136    public void ejbLoad()
137    {
138    }
139
140    public void ejbPassivate()
141    {
142    }
143
144    public void ejbRemove() throws RemoveException JavaDoc
145    {
146    }
147
148    public void ejbStore()
149    {
150    }
151 }
152
Popular Tags