Package org.springframework.jdbc.core.namedparam

Examples of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate


  }
 
  @Autowired
  public void setDataSource(DataSource dataSource) {
    this.dataSource = dataSource;
    this.jdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
  }
View Full Code Here


  }
 
  @Autowired
  public void setDataSource(DataSource dataSource) {
    this.dataSource = dataSource;
    this.jdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
  }
View Full Code Here

  }
 
  @Autowired
  public void setDataSource(DataSource dataSource) {
    this.dataSource = dataSource;
    this.jdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
  }
View Full Code Here

  /**
   * 删除指定的表, 在删除期间disable外键的检查.
   */
  public static void deleteTable(DataSource h2DataSource, String... tableNames) {
    NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(h2DataSource);

    template.update("SET REFERENTIAL_INTEGRITY FALSE",new HashMap<String, Object>());

    for (String tableName : tableNames) {
      template.update("DELETE FROM " + tableName,new HashMap<String, Object>());
    }

    template.update("SET REFERENTIAL_INTEGRITY TRUE",new HashMap<String, Object>());
  }
View Full Code Here

   * Create a new SimpleJdbcTemplate for the given DataSource.
   * <p>Creates a classic Spring JdbcTemplate and wraps it.
   * @param dataSource the JDBC DataSource to access
   */
  public SimpleJdbcTemplate(DataSource dataSource) {
    this.namedParameterJdbcOperations = new NamedParameterJdbcTemplate(dataSource);
  }
View Full Code Here

  /**
   * Create a new SimpleJdbcTemplate for the given classic Spring JdbcTemplate.
   * @param classicJdbcTemplate the classic Spring JdbcTemplate to wrap
   */
  public SimpleJdbcTemplate(JdbcOperations classicJdbcTemplate) {
    this.namedParameterJdbcOperations = new NamedParameterJdbcTemplate(classicJdbcTemplate);
  }
View Full Code Here

   * Create a new SimpleJdbcTemplate for the given DataSource.
   * <p>Creates a classic Spring JdbcTemplate and wraps it.
   * @param dataSource the JDBC DataSource to access
   */
  public SimpleJdbcTemplate(DataSource dataSource) {
    this.namedParameterJdbcOperations = new NamedParameterJdbcTemplate(dataSource);
  }
View Full Code Here

  /**
   * Create a new SimpleJdbcTemplate for the given classic Spring JdbcTemplate.
   * @param classicJdbcTemplate the classic Spring JdbcTemplate to wrap
   */
  public SimpleJdbcTemplate(JdbcOperations classicJdbcTemplate) {
    this.namedParameterJdbcOperations = new NamedParameterJdbcTemplate(classicJdbcTemplate);
  }
View Full Code Here

    new CallTemplate<Integer>() {
      @Override
      Integer doCall(String sql, MapSqlParameterSource params) {
        final RowMapper<T> mapper = new BeanPropertyRowMapper<T>(resultSetClass);

        NamedParameterJdbcTemplate template = new NamedParameterJdbcTemplate(dataSource) {
          @Override
          protected PreparedStatementCreator getPreparedStatementCreator(String sql,
              SqlParameterSource paramSource) {
            PreparedStatementCreator originalCreator = super.getPreparedStatementCreator(sql, paramSource);
            return new StreamingStatementCreator(originalCreator);
          }

        };
        final AtomicInteger rowNum = new AtomicInteger(0);
        template.query(sql, params, new RowCallbackHandler() {

          @Override
          public void processRow(ResultSet rs) throws SQLException {
            handler.handleRow(mapper.mapRow(rs, rowNum.incrementAndGet()));
          }
View Full Code Here

    return maxRowsResultSetExtractor;
  }

  private NamedParameterJdbcOperations getJdbcTemplate() {
    if (namedParameterJdbcTemplate == null)
      namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);

    return namedParameterJdbcTemplate;
  }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate

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.