Package org.springframework.jdbc.core.simple

Examples of org.springframework.jdbc.core.simple.SimpleJdbcInsert


   private SimpleJdbcInsert bookInsert;

   @Autowired(required = true)
   public void initialize(final DataSource dataSource) {
      this.jdbcTemplate = new SimpleJdbcTemplate(dataSource);
      this.bookInsert = new SimpleJdbcInsert(dataSource).withTableName("books")
            .usingGeneratedKeyColumns("id");
   }
View Full Code Here


    private SimpleJdbcInsert simpleInsert;

    @Autowired
  public void init(DataSource dataSource) {
    this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
        this.simpleInsert = new SimpleJdbcInsert(dataSource);
        this.simpleInsert.withTableName("contacts").usingGeneratedKeyColumns("id");
  }
View Full Code Here

  private SimpleJdbcInsert insertGame;

  @Override
  protected void initDao() throws Exception {
    super.initDao();
    insertGame = new SimpleJdbcInsert(getDataSource()).withTableName("GAMES").usingColumns("player_id", "year_no",
        "team", "week", "opponent", " completes", "attempts", "passing_yards", "passing_td", "interceptions",
        "rushes", "rush_yards", "receptions", "receptions_yards", "total_td");
  }
View Full Code Here

  private SimpleJdbcInsert insertGame;

  @Override
  protected void initDao() throws Exception {
    super.initDao();
    insertGame = new SimpleJdbcInsert(getDataSource()).withTableName("GAMES").usingColumns("player_id", "year_no",
        "team", "week", "opponent", " completes", "attempts", "passing_yards", "passing_td", "interceptions",
        "rushes", "rush_yards", "receptions", "receptions_yards", "total_td");
  }
View Full Code Here

        log.debug("Attempting to create episode {}", episode);

        //Note: Remember that spring doesn't generate ID. The database generates the next id. Make sure the database
        // has a trigger or autoincrement facility on the ID column.
        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;
    }
View Full Code Here

        log.debug("Attempting to create resource {}", resource);

        //Note: Remember that spring doesn't generate ID. The database generates the next id. Make sure the database
        // has a trigger or autoincrement facility on the ID column.
        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;
    }
View Full Code Here

  private SimpleJdbcInsert insertTemplate;

  @Autowired
  public void setDataSource(DataSource ds) {
    jdbcTemplate = new JdbcTemplate(ds);
    insertTemplate = new SimpleJdbcInsert(ds).withTableName("memories").usingGeneratedKeyColumns("id").usingColumns("userid", "topic", "watch");
  }
View Full Code Here

  private JdbcTemplate jdbcTemplate;
  private NamedParameterJdbcTemplate namedJdbcTemplate;

  @Autowired
  public void setDataSource(DataSource ds) {
    insert = new SimpleJdbcInsert(ds);

    insert.setTableName("user_events");
    insert.usingColumns("userid", "type", "private", "message_id", "comment_id", "message");

    insertTopicUsersNotified = new SimpleJdbcInsert(ds);
    insertTopicUsersNotified.setTableName("topic_users_notified");
    insertTopicUsersNotified.usingColumns("topic", "userid");

    jdbcTemplate = new JdbcTemplate(ds);
    namedJdbcTemplate = new NamedParameterJdbcTemplate(ds);
View Full Code Here

  @Autowired
  public void setDataSource(DataSource dataSource) {
    jdbcTemplate = new JdbcTemplate(dataSource);

      editInsert =
      new SimpleJdbcInsert(dataSource)
        .withTableName("edit_info")
        .usingColumns(
                "msgid",
                "editor",
                "oldmessage",
View Full Code Here

  @Autowired
  public void setDataSource(DataSource dataSource) {
    jdbcTemplate = new JdbcTemplate(dataSource);
    namedJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);

    insertMsgbase = new SimpleJdbcInsert(dataSource);
    insertMsgbase.setTableName("msgbase");
    insertMsgbase.usingColumns("id", "message");
  }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.simple.SimpleJdbcInsert

Copyright © 2018 www.massapicom. 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.