/**
  * Create PTL_PORTLET_IMAGE Data Bindding JavaBean From ResultSet
  *
  * @param rs ResultSet
  * @return created PtlPortletImageModel
  * @throws SQLException SQL実行例外
  */
 private PtlPortletImageModel __getPtlPortletImageFromRs(ResultSet rs) throws SQLException {
   PtlPortletImageModel bean = new PtlPortletImageModel();
   bean.setPltSid(rs.getInt("PLT_SID"));
   bean.setPliSid(rs.getInt("PLI_SID"));
   bean.setBinSid(rs.getLong("BIN_SID"));
   bean.setPliName(rs.getString("PLI_NAME"));
   return bean;
 }
  /**
   * Insert PTL_PORTLET_IMAGE Data Bindding JavaBean
   *
   * @param bean PTL_PORTLET_IMAGE Data Bindding JavaBean
   * @throws SQLException SQL実行例外
   */
  public void insert(PtlPortletImageModel 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(" PTL_PORTLET_IMAGE(");
      sql.addSql("   PLT_SID,");
      sql.addSql("   PLI_SID,");
      sql.addSql("   BIN_SID,");
      sql.addSql("   PLI_NAME");
      sql.addSql(" )");
      sql.addSql(" values");
      sql.addSql(" (");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?,");
      sql.addSql("   ?");
      sql.addSql(" )");

      pstmt = con.prepareStatement(sql.toSqlString());
      sql.addIntValue(bean.getPltSid());
      sql.addLongValue(bean.getPliSid());
      sql.addLongValue(bean.getBinSid());
      sql.addStrValue(bean.getPliName());
      log__.info(sql.toLogString());
      sql.setParameter(pstmt);
      pstmt.executeUpdate();
    } catch (SQLException e) {
      throw e;
    } finally {
      JDBCUtil.closeStatement(pstmt);
    }
  }
  /**
   * Update PTL_PORTLET_IMAGE Data Bindding JavaBean
   *
   * @param bean PTL_PORTLET_IMAGE Data Bindding JavaBean
   * @return 更新件数
   * @throws SQLException SQL実行例外
   */
  public int update(PtlPortletImageModel 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("   PTL_PORTLET_IMAGE");
      sql.addSql(" set ");
      sql.addSql("   BIN_SID=?,");
      sql.addSql("   PLI_NAME=?");
      sql.addSql(" where ");
      sql.addSql("   PLT_SID=?");
      sql.addSql(" and");
      sql.addSql("   PLI_SID=?");

      pstmt = con.prepareStatement(sql.toSqlString());
      sql.addLongValue(bean.getBinSid());
      sql.addStrValue(bean.getPliName());
      // where
      sql.addIntValue(bean.getPltSid());
      sql.addLongValue(bean.getPliSid());

      log__.info(sql.toLogString());
      sql.setParameter(pstmt);
      count = pstmt.executeUpdate();
    } catch (SQLException e) {
      throw e;
    } finally {
      JDBCUtil.closeStatement(pstmt);
    }
    return count;
  }