⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 preferencesbean.java

📁 Oracle的J2EE Sample
💻 JAVA
字号:
/*
 * @author : Umesh Kulkarni
 * @version 1.0
 *
 * Development Environment : Oracle9i JDeveloper
 *
 * Name of the File : PreferencesBean.java
 *
 * Creation / Modification History
 *    Umesh           26-Apr-2002        Created
 *
 */
package oracle.otnsamples.ibfbs.usermanagement.ejb;

// Import Required EJB Packages
import javax.ejb.EntityContext;

/**
 * This Class acts as Bean Implementation for PreferencesBean which is a local
 * EJB Object. UserAccount is an Entity Object. Every User Account can have
 * multiple Preferences and this  1:N relationship between User Account 
 * Entity Bean and Preferences Bean is managed by the OC4J EJB Container.
 *
 * This new feature called CMR (Container Managed RelationShips) is a new 
 * feature added in EJB 2.0 Specification.
 *
 * Note that A) This class is defined as abstract as Container actually 
 * implements most of the logic for managing relationships (CMRs). 
 * This feature is added in EJB 2.0 Specification
 * B) This Class also do not declare the instance variables such as 
 * AccountNumber, Symbol etc. In earlier approach EJB 1.1, the entity bean 
 * used to declare the instance variables mapping to variables in the 
 * Entity object. This was removed in EJB 2.0 Specification.

 *

 * @version 1.0

 * @since   1.0
 */
public abstract class PreferencesBean implements javax.ejb.EntityBean {

  /**
   * Method which is called by the Container when the client invokes create()
   * method on the home interface.
   *
   * @param id            Primary Key field of the Preferences Bean
   * @param accountNumber Account Number associated with the Preference
   * @param symbol        Symbol for which the alert is set
   * @param prefType      Preference Type to be set
   *                      prefType can be either 'N' - For News, 
   *                                             'S' - For Stock Rates
   *                                          or 'B' for both News and Stocks
   * @return Value of primary key. Here it returns null.
   * @since   1.0

   */
  public Integer ejbCreate(Integer id, Integer accountNumber, 
                           String symbol, String prefType) {
    setId(id);
    setAccountNumber(accountNumber);
    setPrefType(prefType);
    setSymbol(symbol);

    return null;
  }

  /**
   * Method which is called by the Container after invoking of ejbCreate().
   * This method has the same signature as ejbCreate() method.
   *
   * @param id            Primary Key field of the Preferences Bean
   * @param accountNumber Account Number associated with the Preference
   * @param symbol        Symbol for which the alert is set
   * @param prefType      Preference Type to be set
   *                      prefType can be either 'N' - For News, 
   *                                             'S' - For Stock Rates
   *                                          or 'B' for both News and Stocks
   * @since   1.0

   */
  public void ejbPostCreate(Integer id, Integer accountNumber, 
                            String symbol, String prefType) {}

  /**
   * Declare Abstract Methods for persistent fields. Note that the persistent
   * fields are id,accountNumber, Symbol, prefType.
   * These methods are supplied by the EJB Container itself. In EJB 1.1 spec,
   * it was the responsibility of the bean itself to manage these fields.
   */

  /**
   * Method to get the value of Id field. This method definition is provided by
   * the container.
   *
   * @return Desired ID Value
   * @since   1.0

   */
  public abstract Integer getId();

  /**
   * Method to set the value of Id field. This method definition is provided by
   * the container.
   * @param id Value of ID

   * @since   1.0

   *
   */
  public abstract void setId(Integer id);

  /**
   * Method to get the value of accountNumber field. 
   * This method definition is provided by the container.
   *
   * @return Desired acountNumber Value
   * @since   1.0

   */
  public abstract Integer getAccountNumber();

  /**
   * Method to set the value of Account Number field. 
   * The method definition is provided by the container.
   *
   * @param accountNumber  New Value of accountNumber which needs to be set.
   * @since   1.0

   */
  public abstract void setAccountNumber(Integer accountNumber);

  /**
   * Method to get the value of prefType field. 
   * The method definition is provided by the container.
   *
   * @return Desired Preference Type Value
   * @since   1.0

   */
  public abstract String getPrefType();

  /**
   * Method to set the value of Preference Type field. 
   * The method definition is provided by the container.
   *
   * @param prefType  New Value of prefType which needs to be set.
   * @since   1.0

   */
  public abstract void setPrefType(String prefType);

  /**
   * Method to get the value of Symbol field. 
   * The method definition is provided by the container.
   *
   * @return Desired Symbol Value
   * @since   1.0

   */
  public abstract String getSymbol();

  /**
   * Method to set the value of Symbol field. 
   * The method definition is provided by the container.
   *
   * @param symbol  New Value of symbol which needs to be set.
   * @since   1.0

   */
  public abstract void setSymbol(String symbol);

  /**
   * standard call back methods
   */
  public void setEntityContext(EntityContext ec) {}

  public void unsetEntityContext() {}

  public void ejbLoad() {}

  public void ejbStore() {}

  public void ejbActivate() {}

  public void ejbPassivate() {}

  public void ejbRemove() {}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -