一个简单的EJB实例.用DB2连接.JSP页面.很好用.供大家学习

源代码在线查看: ejscmpitemhomebean_ff154d23.java

软件大小: 2249 K
上传用户: face137
关键词: EJB DB2 JSP 连接
下载地址: 免注册下载 普通下载 VIP

相关代码

				package salesdb;								import com.ibm.ejs.container.*;								/**				 * EJSCMPItemHomeBean_ff154d23				 */				public class EJSCMPItemHomeBean_ff154d23 extends EJSHome {					/**					 * EJSCMPItemHomeBean_ff154d23					 */					public EJSCMPItemHomeBean_ff154d23() throws java.rmi.RemoteException {						super();	}					/**					 * create_Local					 */					public salesdb.ItemLocal create_Local(java.lang.Long itemid) throws javax.ejb.CreateException, java.rmi.RemoteException {						BeanO beanO = null;						salesdb.ItemLocal result = null;						boolean createFailed = false;						boolean preCreateFlag = false;						try {							beanO = super.createBeanO();							salesdb.ItemBean bean = (salesdb.ItemBean) beanO.getEnterpriseBean();							preCreateFlag = super.preEjbCreate(beanO);							bean.ejbCreate(itemid);							Object ejsKey = keyFromBean(bean);							result = (salesdb.ItemLocal) super.postCreate_Local(beanO, ejsKey, true);							bean.ejbPostCreate(itemid);							super.afterPostCreate(beanO, ejsKey);						}						catch (javax.ejb.CreateException ex) {							createFailed = true;							throw ex;						} catch (java.rmi.RemoteException ex) {							createFailed = true;							throw ex;						} catch (Throwable ex) {							createFailed = true;							throw new CreateFailureException(ex);						} finally {							if(preCreateFlag && !createFailed)								super.afterPostCreateCompletion(beanO);							if (createFailed) {								super.createFailure(beanO);							}						}						return result;					}					/**					 * findAll_Local					 */					public java.util.Collection findAll_Local() throws javax.ejb.FinderException, java.rmi.RemoteException {						java.util.Collection result = null;						EntityBeanO beanO = null;										try {							beanO = super.getFinderEntityBeanO();							salesdb.ConcreteItem_ff154d23 bean = (salesdb.ConcreteItem_ff154d23) beanO.getEnterpriseBean();							java.util.Collection pKeys = bean.ejbFindAll_Local();							result = super.getCMP20Collection_Local(pKeys);							super.releaseFinderEntityBeanO(beanO);							beanO = null;						}						catch (javax.ejb.FinderException finderEx) {							super.releaseFinderEntityBeanO(beanO);							beanO = null;							throw finderEx;						}						finally {							if (beanO != null )								super.discardFinderEntityBeanO(beanO);						}						return result;					}					/**					 * findByPrimaryKey_Local					 */					public salesdb.ItemLocal findByPrimaryKey_Local(salesdb.ItemKey primaryKey) throws javax.ejb.FinderException, java.rmi.RemoteException {						return (salesdb.ItemLocal)super.activateBean_Local(primaryKey);					}					/**					 * create_Local					 */					public salesdb.ItemLocal create_Local(java.lang.Long itemid, java.lang.String name) throws javax.ejb.CreateException, java.rmi.RemoteException {						BeanO beanO = null;						salesdb.ItemLocal result = null;						boolean createFailed = false;						boolean preCreateFlag = false;						try {							beanO = super.createBeanO();							salesdb.ItemBean bean = (salesdb.ItemBean) beanO.getEnterpriseBean();							preCreateFlag = super.preEjbCreate(beanO);							bean.ejbCreate(itemid, name);							Object ejsKey = keyFromBean(bean);							result = (salesdb.ItemLocal) super.postCreate_Local(beanO, ejsKey, true);							bean.ejbPostCreate(itemid, name);							super.afterPostCreate(beanO, ejsKey);						}						catch (javax.ejb.CreateException ex) {							createFailed = true;							throw ex;						} catch (java.rmi.RemoteException ex) {							createFailed = true;							throw ex;						} catch (Throwable ex) {							createFailed = true;							throw new CreateFailureException(ex);						} finally {							if(preCreateFlag && !createFailed)								super.afterPostCreateCompletion(beanO);							if (createFailed) {								super.createFailure(beanO);							}						}						return result;					}					/**					 * findItemfkByItemfkPurchaseInverseKey_Local					 */					public salesdb.ItemLocal findItemfkByItemfkPurchaseInverseKey_Local(salesdb.PurchaseKey key) throws javax.ejb.FinderException, java.rmi.RemoteException {						salesdb.ItemLocal result = null;						EntityBeanO beanO = null;										salesdb.ItemKey pKey = null;						try {							beanO = super.getFinderEntityBeanO();							salesdb.ConcreteItem_ff154d23 bean = (salesdb.ConcreteItem_ff154d23) beanO.getEnterpriseBean();							pKey = bean.ejbFindItemfkByItemfkPurchaseInverseKey_Local(key);							result = (salesdb.ItemLocal)activateBean_Local(pKey);							super.releaseFinderEntityBeanO(beanO);							beanO = null;						}						catch (javax.ejb.FinderException finderEx) {							super.releaseFinderEntityBeanO(beanO);							beanO = null;							throw finderEx;						}						finally {							if (beanO != null )								super.discardFinderEntityBeanO(beanO);						}						return result;					}					/**					 * findByPrimaryKeyForCMR_Local					 */					public salesdb.ItemLocal findByPrimaryKeyForCMR_Local(salesdb.ItemKey key) throws javax.ejb.FinderException, java.rmi.RemoteException {						return (salesdb.ItemLocal)super.activateBean_Local(key);					}					/**					 * keyFromBean					 */					public Object keyFromBean(javax.ejb.EntityBean generalEJB) {						salesdb.ConcreteItem_ff154d23 tmpEJB = (salesdb.ConcreteItem_ff154d23) generalEJB;						salesdb.ItemKey keyClass = new salesdb.ItemKey();						keyClass.itemid = tmpEJB.getItemid();						return keyClass;					}					/**					 * keyFromFields					 */					public salesdb.ItemKey keyFromFields(java.lang.Long f0) {						salesdb.ItemKey keyClass = new salesdb.ItemKey();						keyClass.itemid = f0;						return keyClass;					}				}							

相关资源