AddressBean |
package com.alodar.example.ejb; /** * @author Mark Lui * * @ejb:bean * type="CMP" * cmp-version="2.x" * name="Address" * jndi-name="com.alodar.example.interfaces.Address" * local-jndi-name="com.alodar.example.interfaces.AddressLocal" * view-type="both" * * @ejb:util * generate="physical" * * @jboss:table-name Address * @jboss:create-table "false" * * @jboss-net:data-object * urn="AddressData" */ public abstract class AddressBean implements javax.ejb.EntityBean { /** * Context set by container */ private javax.ejb.EntityContext _entityContext; /** * Returns the addressId * * @return the addressId * * @ejb:persistent-field * @ejb:pk-field * * @jboss:column-name AddressId */ public abstract Integer getAddressId(); /** * Sets the addressId * * @param addressId the new addressId */ public abstract void setAddressId(Integer addressId); /** * Returns the street1 * * @return the street1 * * @ejb:persistent-field * * * @jboss:column-name Street1 */ public abstract String getStreet1(); /** * Sets the street1 * * @param street1 the new street1 */ public abstract void setStreet1(String street1); /** * Returns the street2 * * @return the street2 * * @ejb:persistent-field * * * @jboss:column-name Street2 */ public abstract String getStreet2(); /** * Sets the street2 * * @param street2 the new street2 */ public abstract void setStreet2(String street2); /** * Returns the city * * @return the city * * @ejb:persistent-field * * * @jboss:column-name City */ public abstract String getCity(); /** * Sets the city * * @param city the new city */ public abstract void setCity(String city); /** * Returns the state * * @return the state * * @ejb:persistent-field * * * @jboss:column-name State */ public abstract String getState(); /** * Sets the state * * @param state the new state */ public abstract void setState(String state); /** * Returns the zip * * @return the zip * * @ejb:persistent-field * * * @jboss:column-name Zip */ public abstract String getZip(); /** * Sets the zip * * @param zip the new zip */ public abstract void setZip(String zip); /** * Returns a local Customer * * @return a local Customer * * @ejb:interface-method view-type="local" * * @ejb:relation * name="Customer-Address" * role-name="Address-has-Customer" * * @jboss:relation * fk-constraint = "true" * fk-column = "CustomerId" * related-pk-field = "customerId" */ public abstract com.alodar.example.interfaces.CustomerLocal getCustomer(); /** * Sets a local Customer * * @param languageCode a local Customer * * @ejb:interface-method view-type="local" */ public abstract void setCustomer(com.alodar.example.interfaces.CustomerLocal customer); /** * Gets a data object representing this instance * * @return a data object representing this instance * * @ejb:interface-method view-type="both" */ public com.alodar.example.interfaces.AddressData getData() { // We don't implement it here. XDoclet will create a subclass that implements it properly. return null; } /** * Sets a data object representing this instance * * @param data a data object holding new values * * @ejb:interface-method view-type="both" */ public void setData(com.alodar.example.interfaces.AddressData data) { // We don't implement it here. XDoclet will create a subclass that implements it properly. } /** * 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: * * Inserts the entity state into the database. * Initializes the instance variables. * Returns the primary key. * * * @param data the data object used to initialise the new instance * @return the primary key of the new instance * * @ejb:create-method */ public com.alodar.example.interfaces.AddressPK ejbCreate(com.alodar.example.interfaces.AddressData data) throws javax.ejb.CreateException { setAddressId(data.getAddressId()); setData(data); // EJB 2.0 spec says return null for CMP ejbCreate methods. return null; } /** * The container invokes thos method immediately after it calls ejbCreate. * * @param data the data object used to initialise the new instance */ public void ejbPostCreate(com.alodar.example.interfaces.AddressData data) throws javax.ejb.CreateException { } // Implementation of the javax.ejb.EntityBean interface methods /** * The container invokes setEntityContext just once - when it creates the bean instance. */ public void setEntityContext(javax.ejb.EntityContext entityContext) { _entityContext = entityContext; } /** * At the end of the life cycle, the container removes the instance from * the pool and invokes this method. */ public void unsetEntityContext() { _entityContext = null; } /** * The container invokes this method to instruct the instance to synchronize its * state by loading it state from the underlying database. */ public void ejbLoad() { } /** * 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. */ public void ejbActivate() { } /** * The container invokes this method on an instance before the instance becomes * disassociated with a specific EJB object. */ public void ejbPassivate() { } /** * The container invokes this method before it removes the EJB object that is * currently associated with the instance. */ public void ejbRemove() throws javax.ejb.RemoveException { } /** * The container invokes this method to instruct the instance to synchronize its * state by storing it to the underlying database. */ public void ejbStore() { } }
AddressBean |