Package org.springframework.jdbc.core.namedparam

Examples of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.update()


   * 删除指定的表, 在删除期间disable外键的检查.
   */
  public static void deleteTable(DataSource h2DataSource, String... tableNames) {
    NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(h2DataSource);

    template.update("SET REFERENTIAL_INTEGRITY FALSE",new HashMap<String, Object>());

    for (String tableName : tableNames) {
      template.update("DELETE FROM " + tableName,new HashMap<String, Object>());
    }

View Full Code Here


    NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(h2DataSource);

    template.update("SET REFERENTIAL_INTEGRITY FALSE",new HashMap<String, Object>());

    for (String tableName : tableNames) {
      template.update("DELETE FROM " + tableName,new HashMap<String, Object>());
    }

    template.update("SET REFERENTIAL_INTEGRITY TRUE",new HashMap<String, Object>());
  }
}
View Full Code Here

    for (String tableName : tableNames) {
      template.update("DELETE FROM " + tableName,new HashMap<String, Object>());
    }

    template.update("SET REFERENTIAL_INTEGRITY TRUE",new HashMap<String, Object>());
  }
}
View Full Code Here

       
        // Do line by line
        int insertCount = 0;
        for (i = 0; i < parameters.length; ++i) {
            try {
                npjt.update(insertQuery, parameters[i]);
                ++insertCount;
            } catch (RuntimeException ex) {
                log.warn(parameters[i].getRecord().toString(), ex);
            }
        }
View Full Code Here

       
            // Do line by line
            int insertCount = 0;
            for (int i = 0; i < parameters.size(); ++i) {
                try {
                    int affectedRows = npjt.update(insertQuery.getSql(), parameters.get(i));                   
                    insertCount += DatabaseUtils.getAffectedRowsNumber(affectedRows);
                   
                } catch (RuntimeException ex2) {
                    log.warn("Could not insert record: "
                            + DatabaseUtils.sqlParameterSourceToText(parameters.get(i)), ex2);
View Full Code Here

      printJob.setJobId(newId.longValue());
    }
    else {
      params.addValue("jobId", printJob.getJobId());
      NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
      namedTemplate.update(PRINT_JOB_UPDATE, params);
    }
    return printJob.getJobId();
  }

  public PrintJob get(long jobId) throws IOException {
View Full Code Here

      try {
        if (namingScheme.validateField("name", run.getName())) {
          params.addValue("runId", run.getId())
                .addValue("name", run.getName());
          NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
          namedTemplate.update(RUN_UPDATE, params);
        }
        else {
          throw new IOException("Cannot save Run - invalid field:" + run.toString());
        }
      }
View Full Code Here

          )
  )
  public boolean remove(Run r) throws IOException {
    NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
    if (r.isDeletable() &&
           (namedTemplate.update(RUN_DELETE,
                            new MapSqlParameterSource().addValue("runId", r.getId())) == 1)) {
      purgeListCache(r, false);
      return true;
    }
    return false;
View Full Code Here

      try {
        if (namingScheme.validateField("name", pcr.getName())) {
          params.addValue("pcrId", pcr.getId())
                .addValue("name", pcr.getName());
          NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
          namedTemplate.update(EMPCR_UPDATE, params);
        }
        else {
          throw new IOException("Cannot save emPCR - invalid field:" + pcr.toString());
        }
      }
View Full Code Here

          )
  )
  public boolean remove(emPCR e) throws IOException {
    NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
    if (e.isDeletable() &&
           (namedTemplate.update(EMPCR_DELETE,
                            new MapSqlParameterSource().addValue("pcrId", e.getId())) == 1)) {
      LibraryDilution ld = e.getLibraryDilution();
      if (this.cascadeType.equals(CascadeType.PERSIST)) {
        if (ld != null) libraryDilutionDAO.save(ld);
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.