Overview
Home Interface
package edu.jbs.ooc.beans; /** * This is a Home interface for the Entity Bean */ public interface DBPersonHome extends javax.ejb.EJBHome { /** * create method for a CMP entity bean * @return edu.jbs.ooc.beans.DBPerson * @param argPersonID java.lang.String * @exception javax.ejb.CreateException The exception description. * @exception java.rmi.RemoteException The exception description. */ edu.jbs.ooc.beans.DBPerson create(java.lang.String argPersonID) throws javax.ejb.CreateException, java.rmi.RemoteException; /** * Insert the method's description here. * Creation date: (3/22/2002 7:51:30 AM) * @return java.util.Enumeration * @param param java.lang.String * @exception java.rmi.RemoteException The exception description. * @exception javax.ejb.FinderException The exception description. */ public java.util.Enumeration findByLastName(String param) throws java.rmi.RemoteException, javax.ejb.FinderException; /** * findByPrimaryKey method comment * @return edu.jbs.ooc.beans.DBPerson * @param key edu.jbs.ooc.beans.DBPersonKey * @exception java.rmi.RemoteException The exception description. * @exception javax.ejb.FinderException The exception description. */ edu.jbs.ooc.beans.DBPerson findByPrimaryKey(edu.jbs.ooc.beans.DBPersonKey key) throws java.rmi.RemoteException, javax.ejb.FinderException; /** * Insert the method's description here. * Creation date: (4/5/2002 11:14:59 AM) * @return java.util.Enumeration * @param paramNameFirst java.lang.String * @param paramNameMiddle java.lang.String * @param paramNameLast java.lang.String * @param paramAddress java.lang.String * @param paramCity java.lang.String * @param paramState java.lang.String * @param paramZip java.lang.String * @param paramPhoneHome java.lang.String * @param paramPhoneWork java.lang.String * @param paramPhoneFax java.lang.String * @param paramPhoneCell java.lang.String * @param paramEmail java.lang.String * @param paramURL java.lang.String * @exception java.rmi.RemoteException The exception description. * @exception javax.ejb.FinderException The exception description. */ java.util.Enumeration findByValues(String paramNameFirst, String paramNameMiddle, String paramNameLast, String paramAddress, String paramCity, String paramState, String paramZip, String paramPhoneHome, String paramPhoneWork, String paramPhoneFax, String paramPhoneCell, String paramEmail, String paramURL) throws java.rmi.RemoteException, javax.ejb.FinderException; }Remote Interface
package edu.jbs.ooc.beans/** * This is an Enterprise Java Bean Remote Interface */ public interface DBPerson extends javax.ejb.EJBObject { /** * Getter method for address * @return java.lang.String * @exception java.rmi.RemoteException The exception description. */ java.lang.String getAddress() throws java.rmi.RemoteException; /** * Getter method for city * @return java.lang.String * @exception java.rmi.RemoteException The exception description. */ java.lang.String getCity() throws java.rmi.RemoteException; /** * Getter method for dateCreated * @return java.sql.Date * @exception java.rmi.RemoteException The exception description. */ java.sql.Date getDateCreated() throws java.rmi.RemoteException; /** * Getter method for dateModified * @return java.sql.Date * @exception java.rmi.RemoteException The exception description. */ java.sql.Date getDateModified() throws java.rmi.RemoteException; /** * Getter method for email * @return java.lang.String * @exception java.rmi.RemoteException The exception description. */ java.lang.String getEmail() throws java.rmi.RemoteException; /** * Getter method for nameFirst * @return java.lang.String * @exception java.rmi.RemoteException The exception description. */ java.lang.String getNameFirst() throws java.rmi.RemoteException; /** * Getter method for nameLast * @return java.lang.String * @exception java.rmi.RemoteException The exception description. */ java.lang.String getNameLast() throws java.rmi.RemoteException; /** * Getter method for nameMiddle * @return java.lang.String * @exception java.rmi.RemoteException The exception description. */ java.lang.String getNameMiddle() throws java.rmi.RemoteException; /** * * @return java.lang.String * @exception String The exception description. */ java.lang.String getPersonID() throws java.rmi.RemoteException; /** * Getter method for phoneCell * @return java.lang.String * @exception java.rmi.RemoteException The exception description. */ java.lang.String getPhoneCell() throws java.rmi.RemoteException; /** * Getter method for phoneFax * @return java.lang.String * @exception java.rmi.RemoteException The exception description. */ java.lang.String getPhoneFax() throws java.rmi.RemoteException; /** * Getter method for phoneHome * @return java.lang.String * @exception java.rmi.RemoteException The exception description. */ java.lang.String getPhoneHome() throws java.rmi.RemoteException; /** * Getter method for phoneWork * @return java.lang.String * @exception java.rmi.RemoteException The exception description. */ java.lang.String getPhoneWork() throws java.rmi.RemoteException; /** * Getter method for state * @return java.lang.String * @exception java.rmi.RemoteException The exception description. */ java.lang.String getState() throws java.rmi.RemoteException; /** * Getter method for url * @return java.lang.String * @exception java.rmi.RemoteException The exception description. */ java.lang.String getUrl() throws java.rmi.RemoteException; /** * Getter method for zip * @return java.lang.String * @exception java.rmi.RemoteException The exception description. */ java.lang.String getZip() throws java.rmi.RemoteException; /** * Setter method for address * @param newValue java.lang.String * @exception java.rmi.RemoteException The exception description. */ void setAddress(java.lang.String newValue) throws java.rmi.RemoteException; /** * Setter method for city * @param newValue java.lang.String * @exception java.rmi.RemoteException The exception description. */ void setCity(java.lang.String newValue) throws java.rmi.RemoteException; /** * Setter method for dateCreated * @param newValue java.sql.Date * @exception java.rmi.RemoteException The exception description. */ void setDateCreated(java.sql.Date newValue) throws java.rmi.RemoteException; /** * Setter method for dateModified * @param newValue java.sql.Date * @exception java.rmi.RemoteException The exception description. */ void setDateModified(java.sql.Date newValue) throws java.rmi.RemoteException; /** * Setter method for email * @param newValue java.lang.String * @exception java.rmi.RemoteException The exception description. */ void setEmail(java.lang.String newValue) throws java.rmi.RemoteException; /** * Setter method for nameFirst * @param newValue java.lang.String * @exception java.rmi.RemoteException The exception description. */ void setNameFirst(java.lang.String newValue) throws java.rmi.RemoteException; /** * Setter method for nameLast * @param newValue java.lang.String * @exception java.rmi.RemoteException The exception description. */ void setNameLast(java.lang.String newValue) throws java.rmi.RemoteException; /** * Setter method for nameMiddle * @param newValue java.lang.String * @exception java.rmi.RemoteException The exception description. */ void setNameMiddle(java.lang.String newValue) throws java.rmi.RemoteException; /** * Setter method for phoneCell * @param newValue java.lang.String * @exception java.rmi.RemoteException The exception description. */ void setPhoneCell(java.lang.String newValue) throws java.rmi.RemoteException; /** * Setter method for phoneFax * @param newValue java.lang.String * @exception java.rmi.RemoteException The exception description. */ void setPhoneFax(java.lang.String newValue) throws java.rmi.RemoteException; /** * Setter method for phoneHome * @param newValue java.lang.String * @exception java.rmi.RemoteException The exception description. */ void setPhoneHome(java.lang.String newValue) throws java.rmi.RemoteException; /** * Setter method for phoneWork * @param newValue java.lang.String * @exception java.rmi.RemoteException The exception description. */ void setPhoneWork(java.lang.String newValue) throws java.rmi.RemoteException; /** * Setter method for state * @param newValue java.lang.String * @exception java.rmi.RemoteException The exception description. */ void setState(java.lang.String newValue) throws java.rmi.RemoteException; /** * Setter method for url * @param newValue java.lang.String * @exception java.rmi.RemoteException The exception description. */ void setUrl(java.lang.String newValue) throws java.rmi.RemoteException; /** * Setter method for zip * @param newValue java.lang.String * @exception java.rmi.RemoteException The exception description. */ void setZip(java.lang.String newValue) throws java.rmi.RemoteException; }Key
package edu.jbs.ooc.beans;public class DBPersonKey implements java.io.Serializable { public java.lang.String personID; private final static long serialVersionUID = 3206093459760846163L; /** * Default constructor */ /* WARNING: THIS METHOD WILL BE REGENERATED. */ public DBPersonKey() { super(); } /** * Initialize a key from the passed values * @param argPersonID java.lang.String */ /* WARNING: THIS METHOD WILL BE REGENERATED. */ public DBPersonKey(java.lang.String argPersonID) { personID = argPersonID; } /** * equals method * @return boolean * @param o java.lang.Object */ /* WARNING: THIS METHOD WILL BE REGENERATED. */ public boolean equals(Object o) { if (o instanceof DBPersonKey) { DBPersonKey otherKey = (DBPersonKey) o; return ((this.personID.equals(otherKey.personID))); } else return false; } /** * hashCode method * @return int */ /* WARNING: THIS METHOD WILL BE REGENERATED. */ public int hashCode() { return (personID.hashCode()); } }Entity Bean
package edu.jbs.ooc.beans; import java.rmi.RemoteException; import java.security.Identity; import java.util.Properties; import javax.ejb.*; /** * This is an Entity Bean class with CMP fields */ public class DBPersonBean implements EntityBean {public String address; public String city; public java.sql.Date dateCreated; public java.sql.Date dateModified; public String email; private javax.ejb.EntityContext entityContext = null; public String nameFirst; public String nameLast; public String nameMiddle; public String personID; public String phoneCell; public String phoneFax; public String phoneHome; public String phoneWork; private final static long serialVersionUID = 3206093459760846163L; public String state; public String url; public String zip; /** * This method was generated for supporting the associations. * @return java.util.Vector */ /* WARNING: THIS METHOD WILL BE REGENERATED. */ protected java.util.Vector _getLinks() { java.util.Vector links = new java.util.Vector(); return links; } /** * This method was generated for supporting the associations. */ /* WARNING: THIS METHOD WILL BE REGENERATED. */ protected void _initLinks() {} /** * This method was generated for supporting the associations. * @exception java.rmi.RemoteException The exception description. * @exception javax.ejb.RemoveException The exception description. */ /* WARNING: THIS METHOD WILL BE REGENERATED. */ protected void _removeLinks() throws java.rmi.RemoteException, javax.ejb.RemoveException { java.util.Enumeration links = _getLinks().elements(); while (links.hasMoreElements()) { try { ((com.ibm.ivj.ejb.associations.interfaces.Link) (links.nextElement())).remove(); } catch (javax.ejb.FinderException e) {} //Consume Finder error since I am going away } } /** * ejbActivate method comment * @exception java.rmi.RemoteException The exception description. */ public void ejbActivate() throws java.rmi.RemoteException { _initLinks(); } /** * ejbCreate method for a CMP entity bean * @param argPersonID java.lang.String * @exception javax.ejb.CreateException The exception description. * @exception java.rmi.RemoteException The exception description. */ public void ejbCreate(java.lang.String argPersonID) throws javax.ejb.CreateException, java.rmi.RemoteException { _initLinks(); // All CMP fields should be initialized here. personID = argPersonID; } /** * ejbLoad method comment * @exception java.rmi.RemoteException The exception description. */ public void ejbLoad() throws java.rmi.RemoteException { _initLinks(); } /** * ejbPassivate method comment * @exception java.rmi.RemoteException The exception description. */ public void ejbPassivate() throws java.rmi.RemoteException {} /** * ejbPostCreate method for a CMP entity bean * @param argPersonID java.lang.String * @exception java.rmi.RemoteException The exception description. */ public void ejbPostCreate(java.lang.String argPersonID) throws java.rmi.RemoteException {} /** * ejbRemove method comment * @exception java.rmi.RemoteException The exception description. * @exception javax.ejb.RemoveException The exception description. */ public void ejbRemove() throws java.rmi.RemoteException, javax.ejb.RemoveException { _removeLinks(); } /** * ejbStore method comment * @exception java.rmi.RemoteException The exception description. */ public void ejbStore() throws java.rmi.RemoteException {} /** * Getter method for address * @return java.lang.String */ public java.lang.String getAddress() { return address; } /** * Getter method for city * @return java.lang.String */ public java.lang.String getCity() { return city; } /** * Getter method for dateCreated * @return java.sql.Date */ public java.sql.Date getDateCreated() { return dateCreated; } /** * Getter method for dateModified * @return java.sql.Date */ public java.sql.Date getDateModified() { return dateModified; } /** * Getter method for email * @return java.lang.String */ public java.lang.String getEmail() { return email; } /** * getEntityContext method comment * @return javax.ejb.EntityContext */ public javax.ejb.EntityContext getEntityContext() { return entityContext; } /** * Getter method for nameFirst * @return java.lang.String */ public java.lang.String getNameFirst() { return nameFirst; } /** * Getter method for nameLast * @return java.lang.String */ public java.lang.String getNameLast() { return nameLast; } /** * Getter method for nameMiddle * @return java.lang.String */ public java.lang.String getNameMiddle() { return nameMiddle; } /** * Insert the method's description here. * Creation date: (2/20/2002 2:17:17 PM) * @return java.lang.String */ public java.lang.String getPersonID() { return personID; } /** * Getter method for phoneCell * @return java.lang.String */ public java.lang.String getPhoneCell() { return phoneCell; } /** * Getter method for phoneFax * @return java.lang.String */ public java.lang.String getPhoneFax() { return phoneFax; } /** * Getter method for phoneHome * @return java.lang.String */ public java.lang.String getPhoneHome() { return phoneHome; } /** * Getter method for phoneWork * @return java.lang.String */ public java.lang.String getPhoneWork() { return phoneWork; } /** * Getter method for state * @return java.lang.String */ public java.lang.String getState() { return state; } /** * Getter method for url * @return java.lang.String */ public java.lang.String getUrl() { return url; } /** * Getter method for zip * @return java.lang.String */ public java.lang.String getZip() { return zip; } /** * Setter method for address * @param newValue java.lang.String */ public void setAddress(java.lang.String newValue) { this.address = newValue; } /** * Setter method for city * @param newValue java.lang.String */ public void setCity(java.lang.String newValue) { this.city = newValue; } /** * Setter method for dateCreated * @param newValue java.sql.Date */ public void setDateCreated(java.sql.Date newValue) { this.dateCreated = newValue; } /** * Setter method for dateModified * @param newValue java.sql.Date */ public void setDateModified(java.sql.Date newValue) { this.dateModified = newValue; } /** * Setter method for email * @param newValue java.lang.String */ public void setEmail(java.lang.String newValue) { this.email = newValue; } /** * setEntityContext method comment * @param ctx javax.ejb.EntityContext * @exception java.rmi.RemoteException The exception description. */ public void setEntityContext(javax.ejb.EntityContext ctx) throws java.rmi.RemoteException { entityContext = ctx; } /** * Setter method for nameFirst * @param newValue java.lang.String */ public void setNameFirst(java.lang.String newValue) { this.nameFirst = newValue; } /** * Setter method for nameLast * @param newValue java.lang.String */ public void setNameLast(java.lang.String newValue) { this.nameLast = newValue; } /** * Setter method for nameMiddle * @param newValue java.lang.String */ public void setNameMiddle(java.lang.String newValue) { this.nameMiddle = newValue; } /** * Setter method for phoneCell * @param newValue java.lang.String */ public void setPhoneCell(java.lang.String newValue) { this.phoneCell = newValue; } /** * Setter method for phoneFax * @param newValue java.lang.String */ public void setPhoneFax(java.lang.String newValue) { this.phoneFax = newValue; } /** * Setter method for phoneHome * @param newValue java.lang.String */ public void setPhoneHome(java.lang.String newValue) { this.phoneHome = newValue; } /** * Setter method for phoneWork * @param newValue java.lang.String */ public void setPhoneWork(java.lang.String newValue) { this.phoneWork = newValue; } /** * Setter method for state * @param newValue java.lang.String */ public void setState(java.lang.String newValue) { this.state = newValue; } /** * Setter method for url * @param newValue java.lang.String */ public void setUrl(java.lang.String newValue) { this.url = newValue; } /** * Setter method for zip * @param newValue java.lang.String */ public void setZip(java.lang.String newValue) { this.zip = newValue; } /** * unsetEntityContext method comment * @exception java.rmi.RemoteException The exception description. */ public void unsetEntityContext() throws java.rmi.RemoteException { entityContext = null; } }Check List
- Create package: Workbench:Projects:Add
- Create BeanGroup, if haven't already done so for Session Beans: Workbench:EJB:EB panel:Add.
- Create Entity Bean: EJB tab: Enterprise Beans panel:Add >ejb. Note add fields and methods through wizard.
- Add members to Remote Interface (automatic option through wizard; manually add any additional methods).
- Add Schema and Map from Beans Panel: Add
- Check Schemas: Beans Panel: Open To > Schema Maps
- Export Schema to Database: EJPTab:Beans panel:Open To >Database Schemas :Schema Browser:Schemas panel:Import/Export>Entire
- Generate Deployed Code: Bean Panel.
- Open To > Server Configuration
- Check properties on Server Configuration to be sure DBMS parameters are correct.
- Start Naming Service: WTE
- Start EJB Server
- Run Test Client: EJB Panel