001: /**
002: *
003: * Bonita
004: * Copyright (C) 1999 Bull S.A.
005: * Bull 68 route de versailles 78434 Louveciennes Cedex France
006: * Further information: bonita@objectweb.org
007: *
008: * This library is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU Lesser General Public
010: * License as published by the Free Software Foundation; either
011: * version 2.1 of the License, or any later version.
012: *
013: * This library is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016: * Lesser General Public License for more details.
017: *
018: * You should have received a copy of the GNU Lesser General Public
019: * License along with this library; if not, write to the Free Software
020: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
021: * USA
022: *
023: *
024: --------------------------------------------------------------------------
025: * $Id: BnNextNumberBean.java,v 1.8 2006/08/21 09:56:41 brice Exp $
026: *
027: --------------------------------------------------------------------------
028: */package hero.entity;
029:
030: import hero.interfaces.InvalidValueException;
031: import hero.interfaces.BnNextNumberPK;
032: import javax.ejb.CreateException;
033: import javax.ejb.EJBException;
034: import javax.ejb.EntityBean;
035: import javax.ejb.EntityContext;
036: import javax.ejb.RemoveException;
037:
038: /**
039: * The Entity bean represents a BnNextNumber
040: *
041: * @ejb:bean name="BnNextNumber"
042: * display-name="NextNumber"
043: * type="CMP"
044: * jndi-name="ejb/hero/BnNextNumber"
045: * local-jndi-name="ejb/hero/BnNextNumber_L"
046: * view-type="both"
047: * cmp-version="2.x"
048: * reentrant="true"
049: *
050: * @ejb:transaction type="Supports"
051: *
052: *
053: * @ejb.pk generate="true" method-intf="both"
054: *
055: * @jonas.jdbc-mapping
056: * jndi-name="bonita"
057: * jdbc-table-name="BnNextNumber"
058: *
059: * @jonas.shared false
060: *
061: * @ejb:finder signature="java.util.Collection findAll()"
062: * query="SELECT object(p) FROM BnNextNumber p"
063: * transaction-type="Supports"
064: *
065: * @ejb.finder signature="hero.interfaces.BnNextNumberLocal findByName(java.lang.String name )" result-type-mapping="Local"
066: * query="SELECT Object(n) From BnNextNumber as n Where n.name = ?1"
067: * transaction-type="Supports"
068: *
069: * @jboss.persistence
070: * table-name="BnNextNumber"
071: * create-table="true"
072: * remove-table="false"
073: *
074: * @jboss.container-configuration name="Standard CMP 2.x EntityBean for Bonita"
075: **/
076: public abstract class BnNextNumberBean implements EntityBean {
077:
078: // -------------------------------------------------------------------------
079: // Members
080: // -------------------------------------------------------------------------
081:
082: public EntityContext mContext;
083:
084: // -------------------------------------------------------------------------
085: // Methods
086: // -------------------------------------------------------------------------
087:
088: // -------------------------------------------------------------------------
089: // Properties (Getters/Setters)
090: // -------------------------------------------------------------------------
091:
092: /**
093: * Retrieve the BnNextNumber id.
094: *
095: * @return Returns an int representing the id of this BnNextNumber.
096: *
097: * @ejb:pk-field
098: * @ejb.value-object
099: * match="light"
100: * @ejb:persistence column-name="id"
101: * @jonas.cmp-field-jdbc-mapping
102: * field-name="id"
103: * jdbc-field-name="id"
104: * @ejb:transaction type="Supports"
105: **/
106: public abstract String getId();
107:
108: /**
109: * Set the BnNextNumber id.
110: *
111: * @param pId The id of this BnNextNumber.
112: * @ejb:transaction type="Required"
113: **/
114: public abstract void setId(String pId);
115:
116: /**
117: * Retrieve the name value.
118: *
119: * @return Returns an String representing the name
120: * @ejb:interface-method view-type="both"
121: *
122: * @ejb:persistence column-name="name"
123: * @ejb:transaction type="Supports"
124: **/
125: public abstract String getName();
126:
127: /**
128: * Set the name value.
129: * @ejb:interface-method view-type="both"
130: * @param name The name value.
131: * @ejb:transaction type="Required"
132: **/
133: public abstract void setName(String name);
134:
135: /**
136: * Retrieve the max value.
137: *
138: * @return Returns an int representing the max
139: * @ejb:interface-method view-type="both"
140: *
141: * @ejb:persistence column-name="maxnumber"
142: * @ejb:transaction type="Supports"
143: **/
144: public abstract int getMax();
145:
146: /**
147: * Set the max value.
148: * @ejb:interface-method view-type="both"
149: * @param max The max value.
150: * @ejb:transaction type="Required"
151: **/
152: public abstract void setMax(int max);
153:
154: // -------------------------------------------------------------------------
155: // Framework Callbacks
156: // -------------------------------------------------------------------------
157:
158: /**
159: * Create a BnNextNumber based on the supplied name.
160: *
161: *
162: * @throws InvalidValueException If one of the values are not correct,
163: * this will not roll back the transaction
164: * because the caller has the chance to
165: * fix the problem and try again
166: * @throws EJBException If no new unique ID could be retrieved this will
167: * rollback the transaction because there is no
168: * hope to try again
169: * @throws CreateException Because we have to do so (EJB spec.)
170: *
171: * @ejb:create-method view-type="both"
172: **/
173: public BnNextNumberPK ejbCreate(String name)
174: throws InvalidValueException, EJBException, CreateException {
175: this .setId(hero.interfaces.BnNextNumberUtil.generateGUID(this ));
176: this .setName(name);
177: this .setMax(1);
178:
179: // This is only possible in CMPs. Otherwise return a valid PK.
180: return null;
181: }
182:
183: public void setEntityContext(EntityContext lContext) {
184: mContext = lContext;
185: }
186:
187: public void unsetEntityContext() {
188: mContext = null;
189: }
190:
191: public void ejbActivate() {
192: }
193:
194: public void ejbPassivate() {
195: }
196:
197: public void ejbLoad() {
198: }
199:
200: public void ejbStore() {
201: }
202:
203: public void ejbRemove() throws RemoveException {
204: }
205:
206: }
|