001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999-2004 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: PhoneBean.java 5832 2004-12-01 13:38:37Z camillej $
023: * --------------------------------------------------------------------------
024: */package xdoclet;
025:
026: import javax.ejb.EntityContext;
027: import java.util.Date;
028: import javax.naming.InitialContext;
029: import javax.naming.NamingException;
030:
031: /**
032: * PhoneBean is an entity bean with "container managed persistence version 2".
033: * The state of an instance is stored into a relational database.
034: *
035: * @ejb.bean
036: * name="PhoneBean"
037: * description="Deployment descriptor for the PhoneBean bean with CMP2 JOnAS example"
038: * type="CMP"
039: * view-type="local"
040: * jndi-name="PhoneBeanHome"
041: * cmp-version="2.x"
042: * reentrant="false"
043: * @ejb.home
044: * local-class="xdoclet.PhoneHomeLocal"
045: * @ejb.interface
046: * local-class="xdoclet.PhoneLocal"
047: * @ejb:pk
048: * class="java.lang.Object"
049: * @jonas.jdbc-mapping
050: * automatic-pk-field-name="pkphone"
051: * @ejb:finder
052: * signature= "java.util.Collection findAllPhones()"
053: * query ="SELECT OBJECT(o) FROM PhoneBean o"
054: * @jonas.session-timeout
055: * session-timeout="60"
056: * @ejb:transaction type="Required"
057: */
058:
059: public abstract class PhoneBean implements javax.ejb.EntityBean {
060:
061: /**
062: * EJBCREATE
063: * @return pk primary key set to null
064: *
065: * @ejb.create-method
066: */
067: public Object ejbCreate(String number, byte type)
068: throws javax.ejb.CreateException {
069: setNumber(number);
070: setType(type);
071: return null;
072: }
073:
074: public void ejbPostCreate(String number, byte type) {
075: System.out.println("PhoneBean ejbPostCreate number= " + number);
076: }
077:
078: /**
079: * @ejb.persistent-field
080: * @ejb.interface-method
081: * @jonas.cmp-field-jdbc-mapping
082: * field-name="number"
083: * jdbc-field-name="PhoneNumber"
084: */
085: public abstract String getNumber();
086:
087: /**
088: * @ejb.persistent-field
089: * @ejb.interface-method
090: */
091: public abstract void setNumber(String number);
092:
093: /**
094: * @ejb.persistent-field
095: * @ejb.interface-method
096: */
097: public abstract byte getType();
098:
099: /**
100: * @ejb.persistent-field
101: * @ejb.interface-method
102: */
103: public abstract void setType(byte type);
104:
105: // standard call back methods
106:
107: public void setEntityContext(EntityContext ec) {
108: }
109:
110: public void unsetEntityContext() {
111: }
112:
113: public void ejbLoad() {
114: }
115:
116: public void ejbStore() {
117: }
118:
119: public void ejbActivate() {
120: }
121:
122: public void ejbPassivate() {
123: }
124:
125: public void ejbRemove() throws javax.ejb.RemoveException {
126: }
127:
128: }
|