Package org.springframework.jdbc.core.simple

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


    );
    return userid;
  }

  private int createTag(String tagName) {
    SimpleJdbcInsert insert =
            new SimpleJdbcInsert(jdbcTemplate)
            .withTableName("tags_values")
            .usingGeneratedKeyColumns("id");

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


   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

  @Autowired
  public void init(DataSource dataSource) {
    this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);

    this.insertOwner = new SimpleJdbcInsert(dataSource)
      .withTableName("owners")
      .usingGeneratedKeyColumns("id");
    this.insertPet = new SimpleJdbcInsert(dataSource)
      .withTableName("pets")
      .usingGeneratedKeyColumns("id");
    this.insertVisit = new SimpleJdbcInsert(dataSource)
      .withTableName("visits")
      .usingGeneratedKeyColumns("id");
  }
View Full Code Here

    private SimpleJdbcInsert paymentInsert;
    private JdbcTemplate accountUpdate;

   public PaymentWriter(DataSource dataSource) {
        paymentInsert = new SimpleJdbcInsert(dataSource).withTableName("PAYMENTS").usingColumns("RECIPIENT", "PAYEE", "AMOUNT", "PAY_DATE");
        accountUpdate = new JdbcTemplate(dataSource);
    }
View Full Code Here

    private SimpleJdbcInsert jdbcInsert;
    private JdbcTemplate jdbcTemplate;

    public void setDataSource(DataSource dataSource) {
        this.jdbcInsert = new SimpleJdbcInsert(dataSource).withTableName("movie");
        this.jdbcTemplate = new JdbcTemplate(dataSource);
    }
View Full Code Here

                put("last_name", actor.getLastName());
                put("birth_date", actor.getBirthDate());
            }
        };

        SimpleJdbcInsert jdbcInsert = new SimpleJdbcInsert(dataSource);
        Number number = jdbcInsert.withTableName("actor").usingGeneratedKeyColumns("id").executeAndReturnKey(map);
        actor.setId(number.intValue());

        SimpleJdbcInsert insert = new SimpleJdbcInsert(dataSource).withTableName("movies_actors");

        List<Movie> movieList = actor.getMovieList();
        map = new HashMap<String, Object>();
        for (Movie movie : movieList) {
            map.put("actor_id", actor.getId());
            map.put("movie_id", movie.getId());

            insert.execute(map);
        }
    }
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.