shopcommodityprocejavabean.java

来自「使用EJB + JSP + JavaBean + Servlet开发的一个远程销」· Java 代码 · 共 114 行

JAVA
114
字号
package flowershoporder.ejb;import java.util.*;import javax.ejb.*;import javax.sql.*;import java.sql.*;import javax.naming.*;import flowershoporder.*;//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -//这是EntityBean(ShopCommodityProcEJB)的Bean Class类//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -public class ShopCommodityProcEJavaBean implements EntityBean  {   public String commodityid = null;   public String commodityname = null;   public int unitprice = 0;   private EntityContext entitycontext = null;   //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   //定义回调方法(callback method)   //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   public void setEntityContext(EntityContext context)     {      this.entitycontext = entitycontext;     }   public void unsetEntityContext()     {      entitycontext = null;     }   public String ejbCreate(String commodityid) throws DuplicateKeyException, CreateException     {      this.commodityid = commodityid;      this.commodityname = "";      this.unitprice = 0;      return null;     }   public void ejbPostCreate(String commodityid)     {}   public String ejbCreate(String commodityid,String commodityname,int unitprice) throws DuplicateKeyException, CreateException     {      this.commodityid = commodityid;      this.commodityname = commodityname;      this.unitprice = unitprice;      return null;     }   public void ejbPostCreate(String commodityid,String commodityname,int unitprice)     {}   public void ejbLoad()     {}   public void ejbStore()     {}   public void ejbActivate()     {      commodityid = (String)entitycontext.getPrimaryKey();     }   public void ejbPassivate()     {      commodityid = null;      commodityname = null;      unitprice = 0;     }   public void ejbRemove()     {}   //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   //定义business方法,这里的business方法同ReaderInfoRemoteInt接口中   //business方法要一一对应   //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -   public void setCommodityname(String commodityname)     {      this.commodityname = commodityname;     }   public void setUnitprice(int unitprice)     {      this.unitprice = unitprice;     }   public void setCommodityInfomation(String commodityname,int unitprice)     {      this.commodityname = commodityname;      this.unitprice = unitprice;     }   public String getCommodityname()     {      return commodityname;     }   public int getUnitprice()     {      return unitprice;     }   public ShopCommodity getCommodityInfomation()     {      ShopCommodity shopcommodity = new ShopCommodity(commodityid,commodityname,unitprice);      return shopcommodity;     }  }

⌨️ 快捷键说明

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