Dao

「Dao」の編集履歴(バックアップ)一覧はこちら

Dao」(2014/08/17 (日) 20:06:32) の最新版変更点

追加された行は緑色になります。

削除された行は赤色になります。

imprt java.sql.*; import javax.naming.NamingException; import -------; public class Dao{ private static final String SELECT_USER_ID_SQL = "select * from user_id = ? and password = ?" private static final String }
Daoクラス imprt java.sql.*; import javax.naming.NamingException; import -------; public class Dao{ private static final String SELECT_USER_ID_SQL = "select * from user_id = ? and password = ?" private static final String UPDATE_PRODUCT_SQL = "UPDATE PRODUCT SET" + "product_name = ?, price = ?, update_date = ? + where product_code = ?;" public Product selectProduct(final String prodectCode) throws NameingExcepton, SQLException{ Connection conn = DaoUtil.getConnection(); Product product = null; try{ PreapredStatement pstmt = conn.prepareStatement(SELECT_PRODUCT_SQL); pstmt.setString(1,prodectCode); ResultSet rs = pstmt.executeQuety(); if (rs.next()){ product = new Product(); product.setCode(rs.getString("PRODUCT_CODE")); product.setName(rs.getString("PRODUCT_NAME")); product.setPrice(rs,getUnt("PRICE")); product.setUpdateDate(rs.getTimestamp("UPDATE_DATE")); } pstmt.close(); }finally{ DaoUtil.closeConnection(conn); } return product; } public int updateProduct(final Product product) throws NameingException,SQLException{ Connection conn = DaoUtil.getConnection(); int updateCount = 0; try{ PreapredStatement pstmt = conn.prepareStatement(UPDATE_PRODUCT_SQL); pstmt.setString(1,product.getName()); pstmt.setInt(2,product.getPrice()); pstmt.setTimestamp(3,new Timestamp(System.currentTimeMillis())); pstmt.setString(4,profuct.getcode()); updateCount = pstmt.executeUpdate()): pstmt.close(); }finally{ DaoUtil.closeConnection(conn); } return updateCount; } }

表示オプション

横に並べて表示:
変化行の前後のみ表示: