Package org.springframework.jdbc.core.namedparam

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


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

    MapSqlParameterSource params = new MapSqlParameterSource();
    params.addValue("concentration", pcr.getConcentration())
          .addValue("creationDate", pcr.getCreationDate())
          .addValue("pcrUserName", pcr.getPcrCreator())
          .addValue("dilution_dilutionId", pcr.getLibraryDilution().getId())
          .addValue("securityProfile_profileId", securityProfileId);
View Full Code Here


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

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

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

      */
    }
    else {
      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 {
View Full Code Here

      }
    )
  )
  public long save(Alert alert) throws IOException {
    MapSqlParameterSource params = new MapSqlParameterSource();
    params.addValue("title", alert.getAlertTitle())
            .addValue("text", alert.getAlertText())
            .addValue("date", alert.getAlertDate())
            .addValue("isRead", alert.getAlertRead())
            .addValue("level", alert.getAlertLevel().getKey());
View Full Code Here

            .addValue("date", alert.getAlertDate())
            .addValue("isRead", alert.getAlertRead())
            .addValue("level", alert.getAlertLevel().getKey());

    if (alert.getAlertUser() != null) {
      params.addValue("userId", alert.getAlertUser().getUserId());
    }

    if (alert.getAlertId() == DefaultAlert.UNSAVED_ID) {
      SimpleJdbcInsert insert = new SimpleJdbcInsert(template)
                            .withTableName(TABLE_NAME)
View Full Code Here

                            .usingGeneratedKeyColumns("alertId");
      Number newId = insert.executeAndReturnKey(params);
      alert.setAlertId(newId.longValue());
    }
    else {
      params.addValue("alertId", alert.getAlertId());
      NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
      namedTemplate.update(ALERT_UPDATE, params);
    }

    return alert.getAlertId();
View Full Code Here

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

    MapSqlParameterSource params = new MapSqlParameterSource();
    params.addValue("alias", experiment.getAlias())
            .addValue("accession", experiment.getAccession())
            .addValue("description", experiment.getDescription())
            .addValue("title", experiment.getTitle())
            .addValue("platform_platformId", experiment.getPlatform().getPlatformId())
            .addValue("securityProfile_profileId", securityProfileId)
View Full Code Here

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

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

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

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

      */
    }

    if (this.cascadeType != null) {
      MapSqlParameterSource eParams = new MapSqlParameterSource();
      eParams.addValue("experiments_experimentId", experiment.getId());
      NamedParameterJdbcTemplate eNamedTemplate = new NamedParameterJdbcTemplate(template);
      eNamedTemplate.update(POOL_EXPERIMENT_DELETE_BY_EXPERIMENT_ID, eParams);

      if (experiment.getPool() != null) {
        SimpleJdbcInsert eInsert = new SimpleJdbcInsert(template)
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.