一个简单的EJB实例.用DB2连接.JSP页面.很好用.供大家学习
源代码在线查看: locationbeanextractor_176caeeb.java
package salesdb.websphere_deploy.DB2UDBNT_V8_1; /** * LocationBeanExtractor_176caeeb */ public class LocationBeanExtractor_176caeeb extends com.ibm.ws.ejbpersistence.dataaccess.AbstractEJBExtractor { /** * LocationBeanExtractor_176caeeb */ public LocationBeanExtractor_176caeeb() { int[] pkCols={3}; setPrimaryKeyColumns(pkCols); int[] dataCols={1,2,3,4}; setDataColumns(dataCols); } /** * extractData */ public com.ibm.ws.ejbpersistence.cache.DataCacheEntry extractData(com.ibm.ws.ejbpersistence.dataaccess.RawBeanData dataRow) throws com.ibm.ws.ejbpersistence.utilpm.ErrorProcessingResultCollectionRow, com.ibm.ws.ejbpersistence.utilpm.PersistenceManagerInternalError { int[] dataColumns = getDataColumns(); salesdb.websphere_deploy.DB2UDBNT_V8_1.LocationBeanCacheEntryImpl_176caeeb entry= new salesdb.websphere_deploy.DB2UDBNT_V8_1.LocationBeanCacheEntryImpl_176caeeb(); entry.setDataForCITY(dataRow.getString(dataColumns[0])); entry.setDataForSTATE(dataRow.getString(dataColumns[1])); entry.setDataForZIPCODE(dataRow.getString(dataColumns[2])); entry.setDataForAREACODE(dataRow.getString(dataColumns[3])); return entry; } /** * extractPrimaryKey */ public Object extractPrimaryKey(com.ibm.ws.ejbpersistence.dataaccess.RawBeanData dataRow) throws com.ibm.ws.ejbpersistence.utilpm.ErrorProcessingResultCollectionRow, com.ibm.ws.ejbpersistence.utilpm.PersistenceManagerInternalError { int[] primaryKeyColumns = getPrimaryKeyColumns(); salesdb.LocationKey key= new salesdb.LocationKey(); key.zipcode=dataRow.getString(primaryKeyColumns[0]); return key; } /** * getHomeName */ public String getHomeName() { return "Location"; } /** * getChunkLength */ public int getChunkLength() { return 4; } }