package airline.ejb;

/**
 * This class is part of Middlegen airlines, and it is
 * a CMP EJB accessing the PERSONS table.
 *
 * @author <a href="http://boss.bekk.no/boss/middlegen/">Middlegen</a>
 * @todo generate create methods which don't take pk as arg (and use an arbitrary pk generator internally)
 *
 * @ejb:finder
 *    signature="java.util.Collection findByFirstNameAndLastName(java.lang.String firstName,java.lang.String lastName)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Person o WHERE o.firstName = ?1 AND o.lastName = ?2"
 *
 * @ejb.bean
 *    type="CMP"
 *    cmp-version="2.x"
 *    name="Person"
 *    local-jndi-name="airline.PersonLocalHome"
 *    view-type="local"
 *    primkey-field="personId"
 *
 * @ejb.finder
 *    signature="java.util.Collection findAll()"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT OBJECT(o) FROM Person o"
 *
 * @ejb.finder
 *    signature="java.util.Collection findByFirstName(java.lang.String firstName)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Person o WHERE o.firstName = ?1"
 *    description="FIRST_NAME is not indexed."
 *
 * @ejb.finder
 *    signature="java.util.Collection findByLastName(java.lang.String lastName)"
 *    result-type-mapping="Local"
 *    method-intf="LocalHome"
 *    query="SELECT DISTINCT OBJECT(o) FROM Person o WHERE o.lastName = ?1"
 *    description="LAST_NAME is not indexed."
 *
 * @ejb.persistence table-name="PERSONS"
 *
 * @weblogic.data-source-name airline.database
 */
public abstract class PersonBean implements javax.ejb.EntityBean {

   /**
    * Returns the personId
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the personId
    *
    * @ejb.pk-field
    * @ejb.interface-method view-type="local"
    * @ejb.persistence column-name="PERSON_ID"
    */
   public abstract java.lang.Integer getPersonId();

   /**
    * Sets the personId
    *
    * @param java.lang.Integer the new personId value
    */
   public abstract void setPersonId(java.lang.Integer personId);

   /**
    * Returns the firstName
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the firstName
    *
    * @ejb.interface-method view-type="local"
    * @ejb.persistence column-name="FIRST_NAME"
    */
   public abstract java.lang.String getFirstName();

   /**
    * Sets the firstName
    *
    * @param java.lang.String the new firstName value
    * @ejb.interface-method view-type="local"
    */
   public abstract void setFirstName(java.lang.String firstName);

   /**
    * Returns the lastName
    * @todo support OracleClob,OracleBlob on WLS
    *
    * @return the lastName
    *
    * @ejb.interface-method view-type="local"
    * @ejb.persistence column-name="LAST_NAME"
    */
   public abstract java.lang.String getLastName();

   /**
    * Sets the lastName
    *
    * @param java.lang.String the new lastName value
    * @ejb.interface-method view-type="local"
    */
   public abstract void setLastName(java.lang.String lastName);

   /**
    * This is a bi-directional one-to-many relationship CMR method
    *
    * @return a java.util.Collection of related airline.interfaces.ReservationLocal.
    * middlegen.plugins.entitybean.Entity20Table@491c4c
    * class middlegen.plugins.entitybean.Entity20Table
    * middlegen.plugins.entitybean.Entity20Table
    * @ejb.interface-method view-type="local"
    *
    * @ejb.relation
    *    name="PERSONS-cmp20-RESERVATIONS-cmp20"
    *    role-name="PERSONS-cmp20-has-RESERVATIONS-cmp20"
    *
    * @jboss.relation-mapping style="foreign-key"
    *
    */
   public abstract java.util.Collection getReservations();

   /**
    * Sets a collection of related airline.interfaces.ReservationLocal
    *
    * @param a collection of related airline.interfaces.ReservationLocal
    *
    * @ejb.interface-method view-type="local"
    *
    * @param reservations the new CMR value
    */
   public abstract void setReservations(java.util.Collection reservations);

   /**
    * 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>
    *
    * @param personId the personId value
    * @param firstName the firstName value
    * @param lastName the lastName value
    * @return the primary key of the new instance
    *
    * @ejb.create-method
    */
   public java.lang.Integer ejbCreate( java.lang.Integer personId, java.lang.String firstName, java.lang.String lastName ) throws javax.ejb.CreateException {
      setPersonId(personId);
      setFirstName(firstName);
      setLastName(lastName);
      // EJB 2.0 spec says return null for CMP ejbCreate methods.
      return null;
   }

   /**
    * The container invokes thos method immediately after it calls ejbCreate. 
    *
    * @param personId the personId value
    * @param firstName the firstName value
    * @param lastName the lastName value
    */
   public void ejbPostCreate( java.lang.Integer personId, java.lang.String firstName, java.lang.String lastName ) throws javax.ejb.CreateException {
      // Set CMR fields
   }

     
   // No /home/pro/middlegen/02.09.02/middlegen/samples/src/middlegen/cmp20-persons-class-code.txt found.

}
