@Override public void updateOrderProduct(OrderProductDTO orderproduct) throws Exception { Connection conn = null; PreparedStatement pstmt = null; try { conn = getConnection(); pstmt = conn.prepareStatement( "UPDATE " + "ORDER_PRODUCT " + "SET OP_ONO=?, OP_PNO=?, OP_COUNT, OP_PRICT " + "WHERE OP_NO=?"); pstmt.setInt(1, orderproduct.getOP_ono()); pstmt.setInt(2, orderproduct.getOP_pno()); pstmt.setInt(3, orderproduct.getOP_count()); pstmt.setInt(4, orderproduct.getOP_price()); pstmt.setInt(5, orderproduct.getOP_no()); pstmt.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { if (pstmt != null) try { pstmt.close(); } catch (SQLException se) { } if (conn != null) try { conn.close(); } catch (SQLException se) { } } }
@Override public void insertOrderProduct(OrderProductDTO orderproduct) throws Exception { Connection conn = null; PreparedStatement pstmt = null; try { conn = getConnection(); pstmt = conn.prepareStatement( "INSERTO INTO ORDER_PRODUCT " + "(OP_NO, OP_ONO, OP_PNO, OP_COUNT, OP_PRICE) " + "VALUES " + "(ORDER_PRODUCT_SEQ.NEXTVAL,?,?,?,?)"); pstmt.setInt(1, orderproduct.getOP_no()); pstmt.setInt(2, orderproduct.getOP_ono()); pstmt.setInt(3, orderproduct.getOP_pno()); pstmt.setInt(4, orderproduct.getOP_count()); pstmt.setInt(5, orderproduct.getOP_price()); pstmt.executeUpdate(); } catch (Exception e) { e.printStackTrace(); } finally { if (pstmt != null) try { pstmt.close(); } catch (SQLException se) { } if (conn != null) try { conn.close(); } catch (SQLException se) { } } }