KickJava   Java API By Example, From Geeks To Geeks.

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


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 import java.util.Collection JavaDoc;
31
32 /**
33  * @ejb.bean
34  * name="Institute"
35  * type="CMP"
36  * cmp-version="2.x"
37  * view-type="local"
38  * reentrant="false"
39  * local-jndi-name="Institute"
40  * @ejb.pk generate="true"
41  * @ejb.util generate="physical"
42  * @ejb.persistence table-name="INSTITUTE"
43  * @jboss.persistence
44  * create-table="true"
45  * remove-table="true"
46  *
47  * @author <a HREF="mailto:alex@jboss.org">Alex Loubyansky</a>
48  */

49 public abstract class InstituteEntityBean
50    implements EntityBean JavaDoc
51 {
52    // Attributes ---------------------------------------------------
53
private EntityContext JavaDoc ctx;
54
55    // CMP accessors
56
/**
57     * @ejb.pk-field
58     * @ejb.persistent-field
59     * @ejb.interface-method
60     * @ejb.persistence column-name="INSTITUTE_ID"
61     */

62    public abstract String JavaDoc getInstituteId();
63    public abstract void setInstituteId(String JavaDoc instituteId);
64
65    /**
66     * @ejb.persistent-field
67     * @ejb.interface-method
68     * @ejb.persistence column-name="DESCR"
69     */

70    public abstract String JavaDoc getDescription();
71    public abstract void setDescription(String JavaDoc description);
72
73    // CMR accessors
74
/**
75     * @ejb.interface-method
76     * @ejb.relation
77     * name="Institute-Department-StandaloneFK"
78     * role-name="Institute-has-Departments"
79     */

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

84    public abstract void setDepartments(Collection JavaDoc departments);
85
86    // EntityBean implementation ------------------------------------
87
/**
88     * @ejb.create-method
89     */

90    public InstitutePK ejbCreate(String JavaDoc instituteId, String JavaDoc descr)
91       throws CreateException JavaDoc
92    {
93       setInstituteId(instituteId);
94       setDescription(descr);
95       return null;
96    }
97
98    public void ejbPostCreate(String JavaDoc instituteId, String JavaDoc descr) {}
99
100    public void ejbActivate() throws EJBException JavaDoc, RemoteException JavaDoc {}
101    public void ejbLoad() throws EJBException JavaDoc, RemoteException JavaDoc {}
102    public void ejbPassivate() throws EJBException JavaDoc, RemoteException JavaDoc {}
103    public void ejbRemove() throws RemoveException JavaDoc, EJBException JavaDoc, RemoteException JavaDoc {}
104    public void ejbStore() throws EJBException JavaDoc, RemoteException JavaDoc {}
105    public void setEntityContext(EntityContext JavaDoc ctx) throws EJBException JavaDoc, RemoteException JavaDoc
106    {
107       this.ctx = ctx;
108    }
109    public void unsetEntityContext() throws EJBException JavaDoc, RemoteException JavaDoc
110    {
111       this.ctx = null;
112    }
113 }
114
Popular Tags