/** * Create SML_BAN_DEST_CONF Data Bindding JavaBean From ResultSet * * @param rs ResultSet * @return created SmlBanDestConfModel * @throws SQLException SQL実行例外 */ private SmlBanDestConfModel __getSmlBanDestConfFromRs(ResultSet rs) throws SQLException { SmlBanDestConfModel bean = new SmlBanDestConfModel(); bean.setSbcSid(rs.getInt("SBC_SID")); bean.setSbcName(rs.getString("SBC_NAME")); bean.setSbcBiko(rs.getString("SBC_BIKO")); bean.setSbcAuid(rs.getInt("SBC_AUID")); bean.setSbcAdate(UDate.getInstanceTimestamp(rs.getTimestamp("SBC_ADATE"))); bean.setSbcEuid(rs.getInt("SBC_EUID")); bean.setSbcEdate(UDate.getInstanceTimestamp(rs.getTimestamp("SBC_EDATE"))); return bean; }
/** * Insert SML_BAN_DEST_CONF Data Bindding JavaBean * * @param bean SML_BAN_DEST_CONF Data Bindding JavaBean * @throws SQLException SQL実行例外 */ public void insert(SmlBanDestConfModel bean) throws SQLException { PreparedStatement pstmt = null; Connection con = null; con = getCon(); try { // SQL文 SqlBuffer sql = new SqlBuffer(); sql.addSql(" insert "); sql.addSql(" into "); sql.addSql(" SML_BAN_DEST_CONF("); sql.addSql(" SBC_SID,"); sql.addSql(" SBC_NAME,"); sql.addSql(" SBC_BIKO,"); sql.addSql(" SBC_AUID,"); sql.addSql(" SBC_ADATE,"); sql.addSql(" SBC_EUID,"); sql.addSql(" SBC_EDATE"); sql.addSql(" )"); sql.addSql(" values"); sql.addSql(" ("); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?,"); sql.addSql(" ?"); sql.addSql(" )"); pstmt = con.prepareStatement(sql.toSqlString()); sql.addIntValue(bean.getSbcSid()); sql.addStrValue(bean.getSbcName()); sql.addStrValue(bean.getSbcBiko()); sql.addIntValue(bean.getSbcAuid()); sql.addDateValue(bean.getSbcAdate()); sql.addIntValue(bean.getSbcEuid()); sql.addDateValue(bean.getSbcEdate()); log__.info(sql.toLogString()); sql.setParameter(pstmt); pstmt.executeUpdate(); } catch (SQLException e) { throw e; } finally { JDBCUtil.closeStatement(pstmt); } }
/** * Update SML_BAN_DEST_CONF Data Bindding JavaBean * * @param bean SML_BAN_DEST_CONF Data Bindding JavaBean * @return 更新件数 * @throws SQLException SQL実行例外 */ public int update(SmlBanDestConfModel bean) throws SQLException { PreparedStatement pstmt = null; int count = 0; Connection con = null; con = getCon(); try { // SQL文 SqlBuffer sql = new SqlBuffer(); sql.addSql(" update"); sql.addSql(" SML_BAN_DEST_CONF"); sql.addSql(" set "); sql.addSql(" SBC_NAME=?,"); sql.addSql(" SBC_BIKO=?,"); sql.addSql(" SBC_AUID=?,"); sql.addSql(" SBC_ADATE=?,"); sql.addSql(" SBC_EUID=?,"); sql.addSql(" SBC_EDATE=?"); sql.addSql(" where "); sql.addSql(" SBC_SID=?"); pstmt = con.prepareStatement(sql.toSqlString()); sql.addStrValue(bean.getSbcName()); sql.addStrValue(bean.getSbcBiko()); sql.addIntValue(bean.getSbcAuid()); sql.addDateValue(bean.getSbcAdate()); sql.addIntValue(bean.getSbcEuid()); sql.addDateValue(bean.getSbcEdate()); // where sql.addIntValue(bean.getSbcSid()); log__.info(sql.toLogString()); sql.setParameter(pstmt); count = pstmt.executeUpdate(); } catch (SQLException e) { throw e; } finally { JDBCUtil.closeStatement(pstmt); } return count; }