KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > test > cmp2 > fkmapping > ejb > ExamenationEntityBean


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.fkmapping.ejb;
23
24 import javax.ejb.EntityContext JavaDoc;
25 import javax.ejb.EntityBean JavaDoc;
26 import javax.ejb.EJBException JavaDoc;
27 import javax.ejb.RemoveException JavaDoc;
28 import javax.ejb.CreateException JavaDoc;
29 import java.rmi.RemoteException JavaDoc;
30
31 /**
32  * @ejb.bean
33  * name="Examenation"
34  * type="CMP"
35  * cmp-version="2.x"
36  * view-type="local"
37  * reentrant="false"
38  * local-jndi-name="Examenation"
39  * @ejb.pk generate="true"
40  * @ejb.util generate="physical"
41  * @ejb.persistence table-name="EXAM"
42  * @jboss.persistence
43  * create-table="true"
44  * remove-table="true"
45  *
46  * @author <a HREF="mailto:alex@jboss.org">Alex Loubyansky</a>
47  */

48 public abstract class ExamenationEntityBean
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     * @ejb.persistence column-name="EXAM_ID"
60     */

61    public abstract String JavaDoc getExamId();
62    public abstract void setExamId(String JavaDoc examId);
63
64    /**
65     * @ejb.persistent-field
66     * @ejb.interface-method
67     * @ejb.persistence column-name="SUBJECT"
68     */

69    public abstract String JavaDoc getSubject();
70    /**
71     * @ejb.interface-method
72     */

73    public abstract void setSubject(String JavaDoc subject);
74
75    /**
76     * @ejb.persistent-field
77     * @ejb.interface-method
78     * @ejb.persistence column-name="DEPT_CODE"
79     */

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

84    public abstract void setDepartmentCode(String JavaDoc deptCode);
85
86    /**
87     * @ejb.persistent-field
88     * @ejb.interface-method
89     * @ejb.persistence column-name="DEPT_CODE2"
90     */

91    public abstract String JavaDoc getDepartmentCode2();
92    /**
93     * @ejb.interface-method
94     */

95    public abstract void setDepartmentCode2(String JavaDoc deptCode);
96
97    /**
98     * @ejb.persistent-field
99     * @ejb.interface-method
100     * @ejb.persistence column-name="GROUP_NUM"
101     */

102    public abstract long getGroupNumber();
103    /**
104     * @ejb.interface-method
105     */

106    public abstract void setGroupNumber(long groupNum);
107
108    // CMR accessors
109
/**
110     * @ejb.interface-method
111     * @ejb.relation
112     * name="Group-Exam-FKToCMP"
113     * role-name="Exam-has-Group"
114     * @jboss.relation
115     * fk-column="DEPT_CODE"
116     * related-pk-field="departmentCode"
117     * @jboss.relation
118     * fk-column="DEPT_CODE2"
119     * related-pk-field="departmentCode2"
120     * @jboss.relation
121     * fk-column="GROUP_NUM"
122     * related-pk-field="groupNumber"
123     */

124    public abstract GroupLocal getGroup();
125    /**
126     * @ejb.interface-method
127     */

128    public abstract void setGroup(GroupLocal group);
129
130    // EntityBean implementation ------------------------------------
131
/**
132     * @ejb.create-method
133     */

134    public ExamenationPK ejbCreate(String JavaDoc examId, String JavaDoc subject, String JavaDoc deptCode, long groupNum)
135       throws CreateException JavaDoc
136    {
137       setExamId(examId);
138       setSubject(subject);
139       setDepartmentCode(deptCode);
140       setDepartmentCode2("X"+deptCode);
141       setGroupNumber(groupNum);
142       return null;
143    }
144
145    public void ejbPostCreate(String JavaDoc examId, String JavaDoc subject, String JavaDoc deptCode, long groupNum) {}
146
147    public void ejbActivate() throws EJBException JavaDoc, RemoteException JavaDoc {}
148    public void ejbLoad() throws EJBException JavaDoc, RemoteException JavaDoc {}
149    public void ejbPassivate() throws EJBException JavaDoc, RemoteException JavaDoc {}
150    public void ejbRemove() throws RemoveException JavaDoc, EJBException JavaDoc, RemoteException JavaDoc {}
151    public void ejbStore() throws EJBException JavaDoc, RemoteException JavaDoc {}
152    public void setEntityContext(EntityContext JavaDoc ctx) throws EJBException JavaDoc, RemoteException JavaDoc
153    {
154       this.ctx = ctx;
155    }
156    public void unsetEntityContext() throws EJBException JavaDoc, RemoteException JavaDoc
157    {
158       this.ctx = null;
159    }
160 }
161
Popular Tags