public String saveProject(final ProjectVO projectVo) {
    LOGGER.info("------------Save Project Method dao");
    try {
      HashMap docMap = new HashMap();
      HashMap imageMap = process(projectVo.getImage());
      final ByteArrayOutputStream imageStream =
          (ByteArrayOutputStream) imageMap.get("byteoutputstream");
      final long imagelength = (long) imageMap.get("length");
      LOGGER.info("first file read");
      if (projectVo.getDocName() != null && projectVo.getDocName().length() > 0) {
        docMap = process(projectVo.getDoc());
      }
      final ByteArrayOutputStream docStream =
          docMap.size() > 0 && docMap.containsKey("byteoutputstream")
              ? (ByteArrayOutputStream) docMap.get("byteoutputstream")
              : null;
      final long doclength =
          docMap.size() > 0 && docMap.containsKey("length") ? (long) docMap.get("length") : 0;

      LOGGER.info("second file read");
      String sql = "";
      if (doclength > 0) {
        sql =
            "INSERT INTO "
                + DT_SCHEMA
                + "."
                + PROJECT_DETAILS_TABLE
                + " ("
                + url
                + ","
                + title
                + ","
                + imageName
                + ","
                + projectName
                + ","
                + projectDescription
                + ","
                + image
                + ","
                + docname
                + ","
                + doc
                + ") "
                + " VALUES "
                + " (?, ?, ? , ?, ?, ?, ? ,?)";
      } else {
        sql =
            "INSERT INTO "
                + DT_SCHEMA
                + "."
                + PROJECT_DETAILS_TABLE
                + " ("
                + url
                + ","
                + title
                + ","
                + imageName
                + ","
                + projectName
                + ","
                + projectDescription
                + ","
                + image
                + ") "
                + " VALUES "
                + " (?, ?, ? , ?, ?, ?)";
      }
      LOGGER.info("SQL Query-->" + sql);
      int cnt =
          primaryJdbcTemplate.update(
              sql,
              new PreparedStatementSetter() {
                public void setValues(PreparedStatement ps) throws SQLException {
                  ps.setString(1, projectVo.getUrl());
                  ps.setString(2, projectVo.getTitle());
                  ps.setString(3, projectVo.getImageName());
                  ps.setString(4, projectVo.getProjectName());
                  ps.setString(5, projectVo.getProjectDescription());
                  ps.setBinaryStream(
                      6, new ByteArrayInputStream(imageStream.toByteArray()), imagelength);
                  if (doclength > 0) {
                    ps.setString(7, projectVo.getDocName());
                    ps.setBinaryStream(
                        8, new ByteArrayInputStream(docStream.toByteArray()), doclength);
                  }
                }
              });

      LOGGER.info("insert count" + cnt);

      // int cnt = primaryJdbcTemplate.update(sql, projectVo.getUrl(), projectVo.getTitle(),
      // projectVo.getImageName(), projectVo.getProjectName(), projectVo.getProjectDescription() ,
      // new ByteArrayi());
      if (cnt > 0) {
        return "success";
      }
      return "failure";
    } catch (Exception ex) {
      LOGGER.info(ex.getMessage());
      return "failure";
    }
  }
  public String editProject(final ProjectVO projectVo) {
    LOGGER.info("-----------Edit project----------------------------");
    try {
      HashMap docMap = new HashMap();
      HashMap imageMap = new HashMap();

      if (projectVo.getDocName() != null && projectVo.getDocName().length() > 0) {
        imageMap = process(projectVo.getImage());
      }

      final ByteArrayOutputStream imageStream =
          imageMap.size() > 0 && imageMap.containsKey("byteoutputstream")
              ? (ByteArrayOutputStream) imageMap.get("byteoutputstream")
              : null;
      final long imagelength =
          imageMap.size() > 0 && imageMap.containsKey("length") ? (long) imageMap.get("length") : 0;

      if (projectVo.getDocName() != null && projectVo.getDocName().length() > 0) {
        docMap = process(projectVo.getDoc());
      }
      final ByteArrayOutputStream docStream =
          docMap.size() > 0 && docMap.containsKey("byteoutputstream")
              ? (ByteArrayOutputStream) docMap.get("byteoutputstream")
              : null;
      final long doclength =
          docMap.size() > 0 && docMap.containsKey("length") ? (long) docMap.get("length") : 0;

      String sql =
          "UPDATE "
              + DT_SCHEMA
              + "."
              + PROJECT_DETAILS_TABLE
              + " set "
              + url
              + "=?,"
              + title
              + "=?, "
              + projectName
              + "=?, "
              + projectDescription
              + " =? ";

      if (imagelength > 0) {
        sql = sql + " ," + imageName + "=? , " + image + "=? ";
      }
      if (doclength > 0) {
        sql = sql + " , " + docname + "=? , " + doc + "=? ";
      }
      sql = sql + " where " + projectId + "=? ";

      LOGGER.info("update sql-->" + sql);
      int cnt =
          primaryJdbcTemplate.update(
              sql,
              new PreparedStatementSetter() {
                public void setValues(PreparedStatement ps) throws SQLException {
                  ps.setString(1, projectVo.getUrl());
                  ps.setString(2, projectVo.getTitle());
                  ps.setString(3, projectVo.getProjectName());
                  ps.setString(4, projectVo.getProjectDescription());

                  if (!(imagelength > 0 || doclength > 0)) {
                    ps.setInt(5, projectVo.getProjectId());
                  } else {
                    if (imagelength > 0) {
                      ps.setString(5, projectVo.getImageName());
                      ps.setBinaryStream(
                          6, new ByteArrayInputStream(imageStream.toByteArray()), imagelength);
                    }
                    if (imagelength > 0 && doclength > 0) {
                      ps.setString(7, projectVo.getDocName());
                      ps.setBinaryStream(
                          8, new ByteArrayInputStream(docStream.toByteArray()), doclength);
                      ps.setInt(9, projectVo.getProjectId());
                    } else if (doclength > 0) {
                      ps.setString(5, projectVo.getDocName());
                      ps.setBinaryStream(
                          6, new ByteArrayInputStream(docStream.toByteArray()), doclength);
                      ps.setInt(7, projectVo.getProjectId());
                    } else {
                      ps.setInt(7, projectVo.getProjectId());
                    }
                  }
                }
              });

      LOGGER.info("Update count" + cnt);

      // int cnt = primaryJdbcTemplate.update(sql, projectVo.getUrl(), projectVo.getTitle(),
      // projectVo.getImageName(), projectVo.getProjectName(), projectVo.getProjectDescription() ,
      // new ByteArrayi());
      if (cnt > 0) {
        return "success";
      }
      return "failure";
    } catch (Exception ex) {
      LOGGER.info(ex.getMessage());
      return "failure";
    }
  }