Examples of executeAndReturnKey()


Examples of org.springframework.jdbc.core.simple.SimpleJdbcInsert.executeAndReturnKey()

    if (user.getUserId() == UserImpl.UNSAVED_ID) {
      SimpleJdbcInsert insert = new SimpleJdbcInsert(template)
                              .withTableName("User")
                              .usingGeneratedKeyColumns("userId");
      Number newId = insert.executeAndReturnKey(params);
      user.setUserId(newId.longValue());
    }
    else {
      params.addValue("userId", user.getUserId());
      NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
View Full Code Here

Examples of org.springframework.jdbc.core.simple.SimpleJdbcInsert.executeAndReturnKey()

    if (group.getGroupId() == Group.UNSAVED_ID) {
      SimpleJdbcInsert insert = new SimpleJdbcInsert(template)
                              .withTableName("_Group")
                              .usingGeneratedKeyColumns("groupId");
      Number newId = insert.executeAndReturnKey(params);
      group.setGroupId(newId.longValue());
    }
    else {
      params.addValue("groupId", group.getGroupId());
      NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
View Full Code Here

Examples of org.springframework.jdbc.core.simple.SimpleJdbcInsert.executeAndReturnKey()

    if (sampleQC.getId() == AbstractSampleQC.UNSAVED_ID) {
      SimpleJdbcInsert insert = new SimpleJdbcInsert(template)
                              .withTableName(TABLE_NAME)
                              .usingGeneratedKeyColumns("qcId");
      Number newId = insert.executeAndReturnKey(params);
      sampleQC.setId(newId.longValue());
    }
    else {
      params.addValue("qcId", sampleQC.getId());
      NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
View Full Code Here

Examples of org.springframework.jdbc.core.simple.SimpleJdbcInsert.executeAndReturnKey()

    if (note.getNoteId() == Note.UNSAVED_ID) {
      SimpleJdbcInsert insert = new SimpleJdbcInsert(template)
              .withTableName(TABLE_NAME)
              .usingGeneratedKeyColumns("noteId");
      Number newId = insert.executeAndReturnKey(params);
      note.setNoteId(newId.longValue());
    }
    return note.getNoteId();
  }
View Full Code Here

Examples of org.springframework.jdbc.core.simple.SimpleJdbcInsert.executeAndReturnKey()

        SimpleJdbcInsert simpleJdbcInsert = new SimpleJdbcInsert(getDataSource()).withTableName(TABLE_NAME)
                .usingGeneratedKeyColumns("ID");

        SqlParameterSource parameters = new BeanPropertySqlParameterSource(episode);

        Number id = simpleJdbcInsert.executeAndReturnKey(parameters);
        episode.setId(id.intValue());
        return episode;
    }

    @Override
View Full Code Here

Examples of org.springframework.jdbc.core.simple.SimpleJdbcInsert.executeAndReturnKey()

        SimpleJdbcInsert simpleJdbcInsert = new SimpleJdbcInsert(getDataSource()).withTableName(TABLE_NAME)
                .usingGeneratedKeyColumns("ID");

        SqlParameterSource parameters = new BeanPropertySqlParameterSource(resource);

        Number id = simpleJdbcInsert.executeAndReturnKey(parameters);
        resource.setId(id.intValue());
        return resource;
    }

    @Override
View Full Code Here

Examples of org.springframework.jdbc.core.simple.SimpleJdbcInsert.executeAndReturnKey()

    SimpleJdbcInsert insert =
            new SimpleJdbcInsert(jdbcTemplate)
            .withTableName("tags_values")
            .usingGeneratedKeyColumns("id");

    return insert.executeAndReturnKey(ImmutableMap.<String, Object>of("value", tagName)).intValue();
}

  @Before
  public void prepareTestData() {
    user1Id = createUser("UserTagDaoIntegrationTest_user1");
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.