Appendix E. Home interface: RegionHome

import java.rmi.RemoteException;
import java.util.Collection;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
import javax.ejb.FinderException;
import javax.ejb.RemoveException;

/** This is the Home interface of the Region Bean */

public interface RegionHome extends EJBHome {

  /**
   * This method is used to create a new Region Bean. Note that the region
   * id is automatically generated by the database (AUTO_INCREMENT) on the
   * primary key.
   *
   * @param name Region name
   *
   * @return pk primary key set to null
   */
  public Region create(String name) throws CreateException, RemoteException, RemoveException;


  /**
   * This method is used to retrieve a Region Bean from its primary key,
   * that is to say its id.
   *
   * @param id Region id (primary key)
   *
   * @return the Region if found else null
   */
  public Region findByPrimaryKey(RegionPK id) throws FinderException, RemoteException;


  /**
   * This method is used to retrieve a Region Bean from its name.
   *
   * @param name Region name
   *
   * @return the Region if found else null
   */
  public Region findByName(String name) throws FinderException, RemoteException;


  /**
   * This method is used to retrieve all categories from the database!
   *
   * @return List of all categories (eventually empty)
   */
  public Collection findAll() throws RemoteException, FinderException;
}