Package org.springframework.jdbc.core.namedparam

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


    //delete existing joins
    MapSqlParameterSource delparams = new MapSqlParameterSource();
    delparams.addValue("userId", user.getUserId());
    NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
    namedTemplate.update(USER_GROUP_DELETE_BY_USER_ID, delparams);

    if (user.getGroups()!= null && !user.getGroups().isEmpty()) {
      SimpleJdbcInsert eInsert = new SimpleJdbcInsert(template)
                            .withTableName("User_Group");
      for (Group g : user.getGroups()) {
View Full Code Here


      group.setGroupId(newId.longValue());
    }
    else {
      params.addValue("groupId", group.getGroupId());
      NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
      namedTemplate.update(GROUP_UPDATE, params);
    }

    return group.getGroupId();   
  }
View Full Code Here

      sampleQC.setId(newId.longValue());
    }
    else {
      params.addValue("qcId", sampleQC.getId());
      NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
      namedTemplate.update(SAMPLE_QC_UPDATE, params);
    }

    if (this.cascadeType != null) {
      Sample s = sampleQC.getSample();
      if (this.cascadeType.equals(CascadeType.PERSIST)) {
View Full Code Here

  }

  public boolean remove(SampleQC qc) throws IOException {
    NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
    if (qc.isDeletable() &&
           (namedTemplate.update(SAMPLE_QC_DELETE,
                                 new MapSqlParameterSource().addValue("qcId", qc.getId())) == 1)) {
      Sample s = qc.getSample();
      if (this.cascadeType.equals(CascadeType.PERSIST)) {
        if (s!=null) sampleDAO.save(s);
      }
View Full Code Here

        if (namingScheme.validateField("name", pool.getName())) {
          params.addValue("poolId", pool.getId())
              .addValue("name", pool.getName())
              .addValue("identificationBarcode", pool.getName() + "::" + pool.getPlatformType().getKey());
          NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
          namedTemplate.update(POOL_UPDATE, params);
        }
        else {
          throw new IOException("Cannot save Pool - invalid field:" + pool.toString());
        }
      }
View Full Code Here

    //log.info("Unlinking elements from pool " + pool.getId());
    MapSqlParameterSource delparams = new MapSqlParameterSource();
    delparams.addValue("pool_poolId", pool.getId());
    NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
    namedTemplate.update(POOL_ELEMENT_DELETE_BY_POOL_ID, delparams);

    if (pool.getPoolableElements() != null && !pool.getPoolableElements().isEmpty()) {
      String type = pool.getPoolableElements().iterator().next().getClass().getSimpleName();

      SimpleJdbcInsert eInsert = new SimpleJdbcInsert(template).withTableName("Pool_Elements");
View Full Code Here

    }

    MapSqlParameterSource poolparams = new MapSqlParameterSource();
    poolparams.addValue("pool_poolId", pool.getId());
    NamedParameterJdbcTemplate poolNamedTemplate = new NamedParameterJdbcTemplate(template);
    poolNamedTemplate.update(POOL_EXPERIMENT_DELETE_BY_POOL_ID, poolparams);

    if (pool.getExperiments() != null && !pool.getExperiments().isEmpty()) {
      //Cache ec = cacheManager.getCache("experimentCache");

      SimpleJdbcInsert eInsert = new SimpleJdbcInsert(template)
View Full Code Here

    poolparams.addValue("pool_poolId", pool.getId());
    poolparams.addValue("poolId", pool.getId());
    NamedParameterJdbcTemplate poolNamedTemplate = new NamedParameterJdbcTemplate(template);

    boolean ok = true;
    if (pool.isDeletable() && poolNamedTemplate.update(POOL_DELETE, poolparams) == 1) {
      if (!pool.getDilutions().isEmpty()) {
        Poolable d = pool.getPoolableElements().iterator().next();
        ok = (poolNamedTemplate.update(POOL_ELEMENT_DELETE_BY_POOL_ID, poolparams) == 1);
        String type = d.getClass().getSimpleName();
        String lc = type.substring(0, 1).toLowerCase() + type.substring(1);
View Full Code Here

    boolean ok = true;
    if (pool.isDeletable() && poolNamedTemplate.update(POOL_DELETE, poolparams) == 1) {
      if (!pool.getDilutions().isEmpty()) {
        Poolable d = pool.getPoolableElements().iterator().next();
        ok = (poolNamedTemplate.update(POOL_ELEMENT_DELETE_BY_POOL_ID, poolparams) == 1);
        String type = d.getClass().getSimpleName();
        String lc = type.substring(0, 1).toLowerCase() + type.substring(1);
        Cache dc = cacheManager.getCache(lc + "Cache");
        Cache ldc = cacheManager.getCache("lazy" + type + "Cache");
View Full Code Here

          }
        }
      }

      if (!pool.getExperiments().isEmpty()) {
        ok = (poolNamedTemplate.update(POOL_EXPERIMENT_DELETE_BY_POOL_ID, poolparams) == 1);
        //Cache ec = cacheManager.getCache("experimentCache");
        Collection<Experiment> exps = pool.getExperiments();
        for (Experiment e : exps) {
          if (this.cascadeType != null) {
            if (this.cascadeType.equals(CascadeType.PERSIST)) {
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.