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

📄 shopcommodityprocejavabean.java

📁 java EJB 编程源代码。
💻 JAVA
字号:
package NetCommodityOrder.scejb;

import java.util.*;
import javax.ejb.*;
import javax.sql.*;
import java.sql.*;
import javax.naming.*;
import NetCommodityOrder.ejbtools.*;

//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//这是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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -