001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.test.cmp2.fkmapping.ejb;
023:
024: import javax.ejb.EntityContext;
025: import javax.ejb.EntityBean;
026: import javax.ejb.EJBException;
027: import javax.ejb.RemoveException;
028: import javax.ejb.CreateException;
029: import java.rmi.RemoteException;
030:
031: /**
032: * @ejb.bean
033: * name="Examenation"
034: * type="CMP"
035: * cmp-version="2.x"
036: * view-type="local"
037: * reentrant="false"
038: * local-jndi-name="Examenation"
039: * @ejb.pk generate="true"
040: * @ejb.util generate="physical"
041: * @ejb.persistence table-name="EXAM"
042: * @jboss.persistence
043: * create-table="true"
044: * remove-table="true"
045: *
046: * @author <a href="mailto:alex@jboss.org">Alex Loubyansky</a>
047: */
048: public abstract class ExamenationEntityBean implements EntityBean {
049: // Attributes ---------------------------------------------------
050: private EntityContext ctx;
051:
052: // CMP accessors
053: /**
054: * @ejb.pk-field
055: * @ejb.persistent-field
056: * @ejb.interface-method
057: * @ejb.persistence column-name="EXAM_ID"
058: */
059: public abstract String getExamId();
060:
061: public abstract void setExamId(String examId);
062:
063: /**
064: * @ejb.persistent-field
065: * @ejb.interface-method
066: * @ejb.persistence column-name="SUBJECT"
067: */
068: public abstract String getSubject();
069:
070: /**
071: * @ejb.interface-method
072: */
073: public abstract void setSubject(String subject);
074:
075: /**
076: * @ejb.persistent-field
077: * @ejb.interface-method
078: * @ejb.persistence column-name="DEPT_CODE"
079: */
080: public abstract String getDepartmentCode();
081:
082: /**
083: * @ejb.interface-method
084: */
085: public abstract void setDepartmentCode(String deptCode);
086:
087: /**
088: * @ejb.persistent-field
089: * @ejb.interface-method
090: * @ejb.persistence column-name="DEPT_CODE2"
091: */
092: public abstract String getDepartmentCode2();
093:
094: /**
095: * @ejb.interface-method
096: */
097: public abstract void setDepartmentCode2(String deptCode);
098:
099: /**
100: * @ejb.persistent-field
101: * @ejb.interface-method
102: * @ejb.persistence column-name="GROUP_NUM"
103: */
104: public abstract long getGroupNumber();
105:
106: /**
107: * @ejb.interface-method
108: */
109: public abstract void setGroupNumber(long groupNum);
110:
111: // CMR accessors
112: /**
113: * @ejb.interface-method
114: * @ejb.relation
115: * name="Group-Exam-FKToCMP"
116: * role-name="Exam-has-Group"
117: * @jboss.relation
118: * fk-column="DEPT_CODE"
119: * related-pk-field="departmentCode"
120: * @jboss.relation
121: * fk-column="DEPT_CODE2"
122: * related-pk-field="departmentCode2"
123: * @jboss.relation
124: * fk-column="GROUP_NUM"
125: * related-pk-field="groupNumber"
126: */
127: public abstract GroupLocal getGroup();
128:
129: /**
130: * @ejb.interface-method
131: */
132: public abstract void setGroup(GroupLocal group);
133:
134: // EntityBean implementation ------------------------------------
135: /**
136: * @ejb.create-method
137: */
138: public ExamenationPK ejbCreate(String examId, String subject,
139: String deptCode, long groupNum) throws CreateException {
140: setExamId(examId);
141: setSubject(subject);
142: setDepartmentCode(deptCode);
143: setDepartmentCode2("X" + deptCode);
144: setGroupNumber(groupNum);
145: return null;
146: }
147:
148: public void ejbPostCreate(String examId, String subject,
149: String deptCode, long groupNum) {
150: }
151:
152: public void ejbActivate() throws EJBException, RemoteException {
153: }
154:
155: public void ejbLoad() throws EJBException, RemoteException {
156: }
157:
158: public void ejbPassivate() throws EJBException, RemoteException {
159: }
160:
161: public void ejbRemove() throws RemoveException, EJBException,
162: RemoteException {
163: }
164:
165: public void ejbStore() throws EJBException, RemoteException {
166: }
167:
168: public void setEntityContext(EntityContext ctx)
169: throws EJBException, RemoteException {
170: this .ctx = ctx;
171: }
172:
173: public void unsetEntityContext() throws EJBException,
174: RemoteException {
175: this.ctx = null;
176: }
177: }
|