KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > test > ejb > cmr > LanguageCodeBean


1 package test.ejb.cmr;
2
3 /**
4     * This class is part of Middlegen airlines, and it is a CMP EJB accessing the language_code table.
5     *
6     * @author <a HREF="http://middlegen.codehaus.org/">Middlegen</a>
7     * @todo generate create methods which don't take pk as arg (and use an arbitrary pk generator internally)
8     * @ejb.bean
9     * cmp-version="2.x"
10     * local-jndi-name="airline.LanguageCodeLocalHome"
11     * name="LanguageCode"
12     * primkey-field="languageCodeId"
13     * type="CMP"
14     * view-type="local"
15     * @ejb.finder
16     * method-intf="LocalHome"
17     * query="SELECT OBJECT(o) FROM LanguageCode o"
18     * result-type-mapping="Local"
19     * signature="java.util.Collection findAll()"
20     * @ejb.finder
21     * method-intf="LocalHome"
22     * query="SELECT DISTINCT OBJECT(o) FROM LanguageCode o WHERE o.language = ?1"
23     * result-type-mapping="Local"
24     * signature="java.util.Collection findByLanguage(test.ejb.cmr.LanguageLocal language)"
25     * @ejb.finder
26     * method-intf="LocalHome"
27     * query="SELECT DISTINCT OBJECT(o) FROM LanguageCode o WHERE o.name = ?1"
28     * result-type-mapping="Local"
29     * signature="java.util.Collection findByName(java.lang.String name)"
30     * @ejb.persistence
31     * table-name="language_code"
32     * @weblogic.data-source-name airline.database
33     * @XXweblogic.data-source-name $table.datasourceName
34     * @XXweblogic.resource-description
35     * @orion.bean
36     * data-source="airline.database"
37     */

38 public abstract class LanguageCodeBean implements javax.ejb.EntityBean JavaDoc {
39
40    /**
41     * Context set by container
42     */

43    private javax.ejb.EntityContext JavaDoc _entityContext;
44
45    /**
46     * Returns the languageCodeId
47     *
48     * @todo support OracleClob,OracleBlob on WLS
49     * @return the languageCodeId
50     * @ejb.persistent-field
51     * @ejb.persistence
52     * column-name="language_code_id"
53     * @ejb.interface-method
54     * view-type="local"
55     * @ejb.pk-field
56     */

57    public abstract java.lang.Integer JavaDoc getLanguageCodeId();
58
59    /**
60     * Sets the languageCodeId
61     *
62     * @param java.lang.Integer the new languageCodeId value
63     */

64    public abstract void setLanguageCodeId(java.lang.Integer JavaDoc languageCodeId);
65
66    /**
67     * Returns the name
68     *
69     * @todo support OracleClob,OracleBlob on WLS
70     * @return the name
71     * @ejb.persistent-field
72     * @ejb.persistence
73     * column-name="name"
74     * @ejb.interface-method
75     * view-type="local"
76     */

77    public abstract java.lang.String JavaDoc getName();
78
79    /**
80     * Sets the name
81     *
82     * @param java.lang.String the new name value
83     * @ejb.interface-method
84     * view-type="local"
85     */

86    public abstract void setName(java.lang.String JavaDoc name);
87
88     /**
89     * Returns the related test.ejb.cmr.LanguageLocal
90     *
91     * @return the related test.ejb.cmr.LanguageLocal
92     * @ejb.interface-method
93     * view-type="local"
94     * @ejb.relation
95     * name="language-language_code"
96     * role-name="language_code-has-language"
97     * @weblogic.target-column-map
98     * foreign-key-column="language_code_id_fk"
99     * @jboss Unidirectional 1->N relationship unsupported by XDoclet
100     */

101    public abstract test.ejb.cmr.LanguageLocal getLanguage();
102
103    /**
104     * Sets the related test.ejb.cmr.LanguageLocal
105     *
106     * @param test.ejb.cmr.LanguageCodeLocal the related language
107     * @ejb.interface-method
108     * view-type="local"
109     * @param language the new CMR value
110     */

111    public abstract void setLanguage(test.ejb.cmr.LanguageLocal language);
112
113     /**
114     * This create method takes only mandatory (non-nullable) parameters. The pk columns must be provided. When the client invokes a create method, the EJB container invokes the ejbCreate method. Typically, an ejbCreate method in an entity bean performs the following tasks: <UL> <LI>Inserts the entity state into the database.</LI> <LI>Initializes the instance variables.</LI> <LI>Returns the primary key.</LI> </UL>
115     *
116     * @param languageCodeId the languageCodeId value
117     * @param name the name value
118     * @param language mandatory CMR field
119     * @return the primary key of the new instance
120     * @ejb.create-method
121     */

122    public java.lang.Integer JavaDoc ejbCreate( java.lang.Integer JavaDoc languageCodeId, java.lang.String JavaDoc name, test.ejb.cmr.LanguageLocal language ) throws javax.ejb.CreateException JavaDoc {
123       setLanguageCodeId(languageCodeId);
124       setName(name);
125       // EJB 2.0 spec says return null for CMP ejbCreate methods.
126
return null;
127    }
128
129    /**
130     * The container invokes thos method immediately after it calls ejbCreate.
131     *
132     * @param languageCodeId the languageCodeId value
133     * @param name the name value
134     * @param language mandatory CMR field
135     */

136    public void ejbPostCreate( java.lang.Integer JavaDoc languageCodeId, java.lang.String JavaDoc name, test.ejb.cmr.LanguageLocal language ) throws javax.ejb.CreateException JavaDoc {
137       // Set CMR fields
138
setLanguage(language);
139    }
140
141      // Implementation of the javax.ejb.EntityBean interface methods
142

143    /**
144     * The container invokes setEntityContext just once - when it creates the bean instance.
145     *
146     */

147    public void setEntityContext(javax.ejb.EntityContext JavaDoc entityContext) {
148       _entityContext = entityContext;
149    }
150
151    /**
152     * At the end of the life cycle, the container removes the instance from the pool and invokes this method.
153     *
154     */

155    public void unsetEntityContext() {
156       _entityContext = null;
157    }
158
159    /**
160     * The container invokes this method to instruct the instance to synchronize its state by loading it state from the underlying database.
161     *
162     */

163    public void ejbLoad() {
164    }
165
166    /**
167     * The container invokes this method when the instance is taken out of the pool of available instances to become associated with a specific EJB object.
168     *
169     */

170    public void ejbActivate() {
171    }
172
173    /**
174     * The container invokes this method on an instance before the instance becomes disassociated with a specific EJB object.
175     *
176     */

177    public void ejbPassivate() {
178    }
179
180    /**
181     * The container invokes this method before it removes the EJB object that is currently associated with the instance.
182     *
183     */

184    public void ejbRemove() throws javax.ejb.RemoveException JavaDoc {
185    }
186
187    /**
188     * The container invokes this method to instruct the instance to synchronize its state by storing it to the underlying database.
189     *
190     */

191    public void ejbStore() {
192    }
193 }
194
Popular Tags