Package org.springframework.jdbc.core.namedparam

Examples of org.springframework.jdbc.core.namedparam.MapSqlParameterSource.addValue()


      if (experiment.getPool() != null) {
        SimpleJdbcInsert eInsert = new SimpleJdbcInsert(template)
                .withTableName("Pool_Experiment");

        MapSqlParameterSource esParams = new MapSqlParameterSource();
        esParams.addValue("experiments_experimentId", experiment.getId())
                .addValue("pool_poolId", experiment.getPool().getId());
        eInsert.execute(esParams);

        if (this.cascadeType.equals(CascadeType.PERSIST)) {
          DbUtils.flushCache(cacheManager, "poolCache");
View Full Code Here


          SimpleJdbcInsert kInsert = new SimpleJdbcInsert(template)
                                .withTableName("Experiment_Kit");

          MapSqlParameterSource kParams = new MapSqlParameterSource();
          kParams.addValue("experiments_experimentId", experiment.getId())
                  .addValue("kits_kidId", k.getId());
          try {
            kInsert.execute(kParams);
          }
          catch(DuplicateKeyException dke) {
View Full Code Here

    }
    catch (SQLException e) {
      e.printStackTrace();
    }

    params.addValue("name", sequencerReference.getName())
            .addValue("ipAddress", ipBlob)
            .addValue("platformId", sequencerReference.getPlatform().getPlatformId())
            .addValue("available", sequencerReference.getAvailable());

    if (sequencerReference.getId() == AbstractSequencerReference.UNSAVED_ID) {
View Full Code Here

      Number newId = insert.executeAndReturnKey(params);
      sequencerReference.setId(newId.longValue());
    }
    else {
      params.addValue("referenceId", sequencerReference.getId());
      NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
      namedTemplate.update(SEQUENCER_REFERENCE_UPDATE, params);
    }

    return sequencerReference.getId();
View Full Code Here

  @Override
  public void saveWatchedEntityUser(Watchable watchable, User user) throws IOException {
    if (user != null) {
      SimpleJdbcInsert fInsert = new SimpleJdbcInsert(template).withTableName("Watcher");
      MapSqlParameterSource fcParams = new MapSqlParameterSource();
      fcParams.addValue("entityName", watchable.getWatchableIdentifier())
              .addValue("userId", user.getUserId());
      try {
        fInsert.execute(fcParams);
        log.debug("DAO insert of " + user.getUserId() + " on " + watchable.getWatchableIdentifier());
      }
View Full Code Here

        (this.cascadeType != null)) { // && this.cascadeType.equals(CascadeType.PERSIST))) {
      securityProfileId = securityProfileDAO.save(project.getSecurityProfile());
    }

    MapSqlParameterSource params = new MapSqlParameterSource();
    params.addValue("alias", project.getAlias())
            .addValue("description", project.getDescription())
            .addValue("creationDate", project.getCreationDate())
            .addValue("securityProfile_profileId", securityProfileId)
            .addValue("progress", project.getProgress().getKey());
View Full Code Here

        String name = namingScheme.generateNameFor("name", project);
        project.setName(name);

        if (namingScheme.validateField("name", project.getName())) {
          params.addValue("name", name);

          Number newId = insert.executeAndReturnKey(params);
          if (newId.longValue() != project.getId()) {
            log.error("Expected Project ID ('"+project.getId()+"') doesn't match returned value ('"+newId.longValue()+"') from database insert: rolling back...");
            new NamedParameterJdbcTemplate(template).update(PROJECT_DELETE, new MapSqlParameterSource().addValue("projectId", newId.longValue()));
View Full Code Here

      */
    }
    else {
      try {
        if (namingScheme.validateField("name", project.getName())) {
          params.addValue("projectId", project.getId())
                .addValue("name", project.getName());
          NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
          namedTemplate.update(PROJECT_UPDATE, params);
        }
        else {
View Full Code Here

    }

    if (this.cascadeType != null) {
      if (this.cascadeType.equals(CascadeType.PERSIST)) {
        MapSqlParameterSource eParams = new MapSqlParameterSource();
        eParams.addValue("project_projectId", project.getProjectId());
        NamedParameterJdbcTemplate eNamedTemplate = new NamedParameterJdbcTemplate(template);
        eNamedTemplate.update(PROJECT_ISSUES_DELETE_BY_PROJECT_ID, eParams);

        if (project.getIssueKeys() != null && !project.getIssueKeys().isEmpty()) {
          for (String s : project.getIssueKeys()) {
View Full Code Here

        if (project.getIssueKeys() != null && !project.getIssueKeys().isEmpty()) {
          for (String s : project.getIssueKeys()) {
            SimpleJdbcInsert fInsert = new SimpleJdbcInsert(template).withTableName("Project_Issues");
            MapSqlParameterSource fcParams = new MapSqlParameterSource();
            fcParams.addValue("project_projectId", project.getProjectId())
                    .addValue("issueKey", s);

            try {
              fInsert.execute(fcParams);
            }
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.