📄 purchasebeanfunctionset_e813240d.java
字号:
package salesdb.websphere_deploy.DB2UDBNT_V8_1;import com.ibm.websphere.rsadapter.WSInteractionSpec;import com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException;import javax.resource.cci.Record;import javax.resource.cci.IndexedRecord;import java.sql.*;/** * PurchaseBeanFunctionSet_e813240d */public class PurchaseBeanFunctionSet_e813240d extends com.ibm.ws.rsadapter.cci.WSResourceAdapterBase implements com.ibm.websphere.rsadapter.DataAccessFunctionSet { private java.util.HashMap functionHash; /** * Create */ public void Create(IndexedRecord inputRecord, Object connection, WSInteractionSpec interactionSpec) throws DataStoreAdapterException { PreparedStatement pstmt = null; try { pstmt = prepareStatement(connection,"INSERT INTO APP.PURCHASE (PURCHASEID, TIMESTMP, ITEMID, LOCATIONID) VALUES (?, ?, ?, ?)"); // For column PURCHASEID { Long tempLong; tempLong=(Long)inputRecord.get(0); if(tempLong != null) pstmt.setLong(1,tempLong.longValue()); else pstmt.setNull(1,java.sql.Types.BIGINT); } // For column TIMESTMP { String tempString; tempString=(String)inputRecord.get(1); if(tempString != null) pstmt.setString(2,tempString); else pstmt.setNull(2,java.sql.Types.VARCHAR); } // For column ITEMID { Long tempLong; tempLong=(Long)inputRecord.get(2); if(tempLong != null) pstmt.setLong(3,tempLong.longValue()); else pstmt.setNull(3,java.sql.Types.BIGINT); } // For column LOCATIONID { String tempString; tempString=(String)inputRecord.get(3); if(tempString != null) pstmt.setString(4,tempString); else pstmt.setNull(4,java.sql.Types.CHAR); } if (pstmt.executeUpdate()==0) throw new DataStoreAdapterException("DSA_ERROR",new javax.ejb.NoSuchEntityException(), this.getClass()); } catch (SQLException e) { throw new DataStoreAdapterException("DSA_ERROR", e ,this.getClass()); } finally { try { if(pstmt != null) { returnPreparedStatement(connection, pstmt); } } catch (SQLException ignored) {} } } /** * Remove */ public void Remove(IndexedRecord inputRecord, Object connection, WSInteractionSpec interactionSpec) throws DataStoreAdapterException { PreparedStatement pstmt = null; try { pstmt = prepareStatement(connection,"DELETE FROM APP.PURCHASE WHERE PURCHASEID = ?"); // For column PURCHASEID { Long tempLong; tempLong=(Long)inputRecord.get(0); if(tempLong != null) pstmt.setLong(1,tempLong.longValue()); else pstmt.setNull(1,java.sql.Types.BIGINT); } if (pstmt.executeUpdate()==0) throw new DataStoreAdapterException("DSA_ERROR",new javax.ejb.NoSuchEntityException(), this.getClass()); } catch (SQLException e) { throw new DataStoreAdapterException("DSA_ERROR", e ,this.getClass()); } finally { try { if(pstmt != null) { returnPreparedStatement(connection, pstmt); } } catch (SQLException ignored) {} } } /** * Store */ public void Store(IndexedRecord inputRecord, Object connection, WSInteractionSpec interactionSpec) throws DataStoreAdapterException { PreparedStatement pstmt = null; try { pstmt = prepareStatement(connection,"UPDATE APP.PURCHASE SET TIMESTMP = ?, ITEMID = ?, LOCATIONID = ? WHERE PURCHASEID = ?"); // For column PURCHASEID { Long tempLong; tempLong=(Long)inputRecord.get(0); if(tempLong != null) pstmt.setLong(4,tempLong.longValue()); else pstmt.setNull(4,java.sql.Types.BIGINT); } // For column TIMESTMP { String tempString; tempString=(String)inputRecord.get(1); if(tempString != null) pstmt.setString(1,tempString); else pstmt.setNull(1,java.sql.Types.VARCHAR); } // For column ITEMID { Long tempLong; tempLong=(Long)inputRecord.get(2); if(tempLong != null) pstmt.setLong(2,tempLong.longValue()); else pstmt.setNull(2,java.sql.Types.BIGINT); } // For column LOCATIONID { String tempString; tempString=(String)inputRecord.get(3); if(tempString != null) pstmt.setString(3,tempString); else pstmt.setNull(3,java.sql.Types.CHAR); } if (pstmt.executeUpdate()==0) throw new DataStoreAdapterException("DSA_ERROR",new javax.ejb.NoSuchEntityException(), this.getClass()); } catch (SQLException e) { throw new DataStoreAdapterException("DSA_ERROR", e ,this.getClass()); } finally { try { if(pstmt != null) { returnPreparedStatement(connection, pstmt); } } catch (SQLException ignored) {} } } /** * StoreUsingOCC */ public void StoreUsingOCC(IndexedRecord inputRecord, Object connection, WSInteractionSpec interactionSpec) throws DataStoreAdapterException { PreparedStatement pstmt = null; try { pstmt = prepareStatement(connection,"UPDATE APP.PURCHASE SET TIMESTMP = ?, ITEMID = ?, LOCATIONID = ? WHERE PURCHASEID = ? AND TIMESTMP = ?"); // For column PURCHASEID { Long tempLong; tempLong=(Long)inputRecord.get(0); if(tempLong != null) pstmt.setLong(4,tempLong.longValue()); else pstmt.setNull(4,java.sql.Types.BIGINT); } // For column TIMESTMP { String tempString; tempString=(String)inputRecord.get(1); if(tempString != null) pstmt.setString(1,tempString); else pstmt.setNull(1,java.sql.Types.VARCHAR); } // For column ITEMID { Long tempLong; tempLong=(Long)inputRecord.get(2); if(tempLong != null) pstmt.setLong(2,tempLong.longValue()); else pstmt.setNull(2,java.sql.Types.BIGINT); } // For column LOCATIONID { String tempString; tempString=(String)inputRecord.get(3); if(tempString != null) pstmt.setString(3,tempString); else pstmt.setNull(3,java.sql.Types.CHAR); } IndexedRecord oldRecord = interactionSpec.getOldRecord(); // For column TIMESTMP { String tempString; tempString=(String)oldRecord.get(1); if(tempString != null) pstmt.setString(5,tempString); else pstmt.setNull(5,java.sql.Types.VARCHAR); } if (pstmt.executeUpdate()==0) throw new DataStoreAdapterException("DSA_ERROR",new javax.ejb.NoSuchEntityException(), this.getClass()); } catch (SQLException e) { throw new DataStoreAdapterException("DSA_ERROR", e ,this.getClass()); } finally { try { if(pstmt != null) { returnPreparedStatement(connection, pstmt); } } catch (SQLException ignored) {} } } /** * FindByPrimaryKey */ public javax.resource.cci.Record FindByPrimaryKey(IndexedRecord inputRecord, Object connection, WSInteractionSpec interactionSpec) throws DataStoreAdapterException { PreparedStatement pstmt = null; ResultSet result=null; try { pstmt = prepareStatement(connection,"SELECT T1.PURCHASEID, T1.TIMESTMP, T1.ITEMID, T1.LOCATIONID FROM APP.PURCHASE T1 WHERE T1.PURCHASEID = ?"); // For column PURCHASEID { Long tempLong; tempLong=(Long)inputRecord.get(0); if(tempLong != null) pstmt.setLong(1,tempLong.longValue()); else pstmt.setNull(1,java.sql.Types.BIGINT); } result = pstmt.executeQuery(); } catch (SQLException e) { throw new DataStoreAdapterException("DSA_ERROR", e ,this.getClass()); } return createCCIRecord(connection, result); } /** * FindByPrimaryKeyForUpdate */ public javax.resource.cci.Record FindByPrimaryKeyForUpdate(IndexedRecord inputRecord, Object connection, WSInteractionSpec interactionSpec) throws DataStoreAdapterException { PreparedStatement pstmt = null; ResultSet result=null; try { pstmt = prepareStatement(connection,"SELECT T1.PURCHASEID, T1.TIMESTMP, T1.ITEMID, T1.LOCATIONID FROM APP.PURCHASE T1 WHERE T1.PURCHASEID = ? FOR UPDATE OF TIMESTMP"); // For column PURCHASEID { Long tempLong; tempLong=(Long)inputRecord.get(0); if(tempLong != null) pstmt.setLong(1,tempLong.longValue()); else pstmt.setNull(1,java.sql.Types.BIGINT); } result = pstmt.executeQuery(); } catch (SQLException e) { throw new DataStoreAdapterException("DSA_ERROR", e ,this.getClass()); } return createCCIRecord(connection, result); } /** * findItemfkPurchaseInverseByItemfkKey_Local */ public javax.resource.cci.Record findItemfkPurchaseInverseByItemfkKey_Local(IndexedRecord inputRecord, Object connection, WSInteractionSpec interactionSpec) throws DataStoreAdapterException { PreparedStatement pstmt = null; ResultSet result=null; try { pstmt = prepareStatement(connection,"SELECT T1.PURCHASEID, T1.TIMESTMP, T1.ITEMID, T1.LOCATIONID FROM APP.PURCHASE T1 WHERE T1.ITEMID = ?"); // For column ITEMID { Long tempLong; tempLong=(Long)inputRecord.get(0); if(tempLong != null) pstmt.setLong(1,tempLong.longValue()); else pstmt.setNull(1,java.sql.Types.BIGINT); } result = pstmt.executeQuery(); } catch (SQLException e) { throw new DataStoreAdapterException("DSA_ERROR", e ,this.getClass()); } return createCCIRecord(connection, result); } /** * findItemfkPurchaseInverseByItemfkKey_LocalForUpdate */ public javax.resource.cci.Record findItemfkPurchaseInverseByItemfkKey_LocalForUpdate(IndexedRecord inputRecord, Object connection, WSInteractionSpec interactionSpec) throws DataStoreAdapterException { PreparedStatement pstmt = null; ResultSet result=null; try { pstmt = prepareStatement(connection,"SELECT T1.PURCHASEID, T1.TIMESTMP, T1.ITEMID, T1.LOCATIONID FROM APP.PURCHASE T1 WHERE T1.ITEMID = ? FOR UPDATE OF TIMESTMP"); // For column ITEMID { Long tempLong; tempLong=(Long)inputRecord.get(0); if(tempLong != null) pstmt.setLong(1,tempLong.longValue()); else pstmt.setNull(1,java.sql.Types.BIGINT); } result = pstmt.executeQuery(); } catch (SQLException e) { throw new DataStoreAdapterException("DSA_ERROR", e ,this.getClass()); } return createCCIRecord(connection, result); } /** * findLocationfkPurchaseInverseByLocationfkKey_Local */ public javax.resource.cci.Record findLocationfkPurchaseInverseByLocationfkKey_Local(IndexedRecord inputRecord, Object connection, WSInteractionSpec interactionSpec) throws DataStoreAdapterException { PreparedStatement pstmt = null; ResultSet result=null; try { pstmt = prepareStatement(connection,"SELECT T1.PURCHASEID, T1.TIMESTMP, T1.ITEMID, T1.LOCATIONID FROM APP.PURCHASE T1 WHERE T1.LOCATIONID = ?"); // For column LOCATIONID { String tempString; tempString=(String)inputRecord.get(0); if(tempString != null) pstmt.setString(1,tempString); else pstmt.setNull(1,java.sql.Types.CHAR); } result = pstmt.executeQuery(); } catch (SQLException e) { throw new DataStoreAdapterException("DSA_ERROR", e ,this.getClass()); } return createCCIRecord(connection, result); } /** * findLocationfkPurchaseInverseByLocationfkKey_LocalForUpdate */ public javax.resource.cci.Record findLocationfkPurchaseInverseByLocationfkKey_LocalForUpdate(IndexedRecord inputRecord, Object connection, WSInteractionSpec interactionSpec) throws DataStoreAdapterException { PreparedStatement pstmt = null; ResultSet result=null; try { pstmt = prepareStatement(connection,"SELECT T1.PURCHASEID, T1.TIMESTMP, T1.ITEMID, T1.LOCATIONID FROM APP.PURCHASE T1 WHERE T1.LOCATIONID = ? FOR UPDATE OF TIMESTMP"); // For column LOCATIONID { String tempString; tempString=(String)inputRecord.get(0); if(tempString != null) pstmt.setString(1,tempString); else pstmt.setNull(1,java.sql.Types.CHAR); } result = pstmt.executeQuery(); } catch (SQLException e) { throw new DataStoreAdapterException("DSA_ERROR", e ,this.getClass()); } return createCCIRecord(connection, result); } /** * PurchaseBeanFunctionSet_e813240d */ public PurchaseBeanFunctionSet_e813240d() { functionHash=new java.util.HashMap(10); functionHash.put("Create",new Integer(0)); functionHash.put("Remove",new Integer(1)); functionHash.put("Store",new Integer(2)); functionHash.put("StoreUsingOCC",new Integer(3)); functionHash.put("FindByPrimaryKey",new Integer(4)); functionHash.put("FindByPrimaryKeyForUpdate",new Integer(5)); functionHash.put("findItemfkPurchaseInverseByItemfkKey_Local",new Integer(6)); functionHash.put("findItemfkPurchaseInverseByItemfkKey_LocalForUpdate",new Integer(7)); functionHash.put("findLocationfkPurchaseInverseByLocationfkKey_Local",new Integer(8)); functionHash.put("findLocationfkPurchaseInverseByLocationfkKey_LocalForUpdate",new Integer(9)); } /** * execute */ public Record execute(WSInteractionSpec interactionSpec, IndexedRecord inputRecord, Object connection) throws javax.resource.ResourceException { String functionName=interactionSpec.getFunctionName(); Record outputRecord=null; int functionIndex=((Integer)functionHash.get(functionName)).intValue(); switch (functionIndex) { case 0: Create(inputRecord,connection,interactionSpec); break; case 1: Remove(inputRecord,connection,interactionSpec); break; case 2: Store(inputRecord,connection,interactionSpec); break; case 3: StoreUsingOCC(inputRecord,connection,interactionSpec); break; case 4: outputRecord=FindByPrimaryKey(inputRecord,connection,interactionSpec); break; case 5: outputRecord=FindByPrimaryKeyForUpdate(inputRecord,connection,interactionSpec); break; case 6: outputRecord=findItemfkPurchaseInverseByItemfkKey_Local(inputRecord,connection,interactionSpec); break; case 7: outputRecord=findItemfkPurchaseInverseByItemfkKey_LocalForUpdate(inputRecord,connection,interactionSpec); break; case 8: outputRecord=findLocationfkPurchaseInverseByLocationfkKey_Local(inputRecord,connection,interactionSpec); break; case 9: outputRecord=findLocationfkPurchaseInverseByLocationfkKey_LocalForUpdate(inputRecord,connection,interactionSpec); break; } return outputRecord; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -