Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.PreparedStatementCreatorFactory$PreparedStatementCreatorImpl


    ParsedSql parsedSql = getParsedSql(sql);
    String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource);
    Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, null);
    List<SqlParameter> declaredParameters = NamedParameterUtils.buildSqlParameterList(parsedSql, paramSource);
    PreparedStatementCreatorFactory pscf = new PreparedStatementCreatorFactory(sqlToUse, declaredParameters);
    if (keyColumnNames != null) {
      pscf.setGeneratedKeysColumnNames(keyColumnNames);
    }
    else {
      pscf.setReturnGeneratedKeys(true);
    }
    return getJdbcOperations().update(pscf.newPreparedStatementCreator(params), generatedKeyHolder);
  }
View Full Code Here


  protected PreparedStatementCreator getPreparedStatementCreator(String sql, SqlParameterSource paramSource) {
    ParsedSql parsedSql = getParsedSql(sql);
    String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource);
    Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, null);
    List<SqlParameter> declaredParameters = NamedParameterUtils.buildSqlParameterList(parsedSql, paramSource);
    PreparedStatementCreatorFactory pscf = new PreparedStatementCreatorFactory(sqlToUse, declaredParameters);
    return pscf.newPreparedStatementCreator(params);
  }
View Full Code Here

      int i = 0;
      for ( IQueryParameter p : query ){
         types[i++] = StatementCreatorUtils.javaTypeToSqlParameterType(p.getColumnMetadata().getType());
      }
      int res = getWriteJdbcTemplate().update(
               new PreparedStatementCreatorFactory(query.getSql(),types)
               .newPreparedStatementCreator(query.getParameterValues()), holder);
      if ( holder != null && holder.getKeyList().size() == 1 ){
         for ( ColumnMetadata col : controller.getColumns().values() ){
            if ( col.isIdentity() == Boolean.TRUE ){
               Number number = holder.getKey();
View Full Code Here

    ParsedSql parsedSql = getParsedSql(sql);
    String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource);
    Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, null);
    int[] paramTypes = NamedParameterUtils.buildSqlTypeArray(parsedSql, paramSource);
    PreparedStatementCreatorFactory pscf = new PreparedStatementCreatorFactory(sqlToUse, paramTypes);
    if (keyColumnNames != null) {
      pscf.setGeneratedKeysColumnNames(keyColumnNames);
    }
    else {
      pscf.setReturnGeneratedKeys(true);
    }
    return getJdbcOperations().update(pscf.newPreparedStatementCreator(params), generatedKeyHolder);
  }
View Full Code Here

  protected PreparedStatementCreator getPreparedStatementCreator(String sql, SqlParameterSource paramSource) {
    ParsedSql parsedSql = getParsedSql(sql);
    String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource);
    Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, null);
    int[] paramTypes = NamedParameterUtils.buildSqlTypeArray(parsedSql, paramSource);
    PreparedStatementCreatorFactory pscf = new PreparedStatementCreatorFactory(sqlToUse, paramTypes);
    return pscf.newPreparedStatementCreator(params);
  }
View Full Code Here

  /**
   * Overridden method to configure the PreparedStatementCreatorFactory
   * based on our declared parameters.
   */
  protected final void compileInternal() {
    this.preparedStatementFactory = new PreparedStatementCreatorFactory(getSql(), getDeclaredParameters());
    this.preparedStatementFactory.setResultSetType(getResultSetType());
    this.preparedStatementFactory.setUpdatableResults(isUpdatableResults());
    this.preparedStatementFactory.setReturnGeneratedKeys(isReturnGeneratedKeys());
    if (getGeneratedKeysColumnNames() != null) {
      this.preparedStatementFactory.setGeneratedKeysColumnNames(getGeneratedKeysColumnNames());
View Full Code Here

    ParsedSql parsedSql = getParsedSql(sql);
    String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource);
    Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, null);
    int[] paramTypes = NamedParameterUtils.buildSqlTypeArray(parsedSql, paramSource);
    PreparedStatementCreatorFactory pscf = new PreparedStatementCreatorFactory(sqlToUse, paramTypes);
    if (keyColumnNames != null) {
      pscf.setGeneratedKeysColumnNames(keyColumnNames);
    }
    else {
      pscf.setReturnGeneratedKeys(true);
    }
    return getJdbcOperations().update(pscf.newPreparedStatementCreator(params), generatedKeyHolder);
  }
View Full Code Here

  protected PreparedStatementCreator getPreparedStatementCreator(String sql, SqlParameterSource paramSource) {
    ParsedSql parsedSql = getParsedSql(sql);
    String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource);
    Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, null);
    int[] paramTypes = NamedParameterUtils.buildSqlTypeArray(parsedSql, paramSource);
    PreparedStatementCreatorFactory pscf = new PreparedStatementCreatorFactory(sqlToUse, paramTypes);
    return pscf.newPreparedStatementCreator(params);
  }
View Full Code Here

        // see NamedParameterJdbcTemplate#getPreparedStatementCreator(String sql, SqlParameterSource paramSource)
        ParsedSql parsedSql = parseSqlStatement(sql);
        String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource);
        Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, null);
        List<SqlParameter> declaredParameters = NamedParameterUtils.buildSqlParameterList(parsedSql, paramSource);
        PreparedStatementCreatorFactory pscf = new PreparedStatementCreatorFactory(sqlToUse, declaredParameters);
        PreparedStatementCreator psc = pscf.newPreparedStatementCreator(params);
        PreparedStatement stmt = psc.createPreparedStatement(con);
        registry.put(registryKey, stmt);
        return stmt;
    }
View Full Code Here

      logger.info("Updated venue (ID = " + venueId + ")");
      return eventId;
    } catch (IncorrectResultSizeDataAccessException e) {
      // insert if it doesn't exist
      KeyHolder keyHolder = new GeneratedKeyHolder();
      jdbcTemplate.update(new PreparedStatementCreatorFactory(INSERT_EVENT, new int[] {VARCHAR, VARCHAR, VARCHAR, TIMESTAMP, TIMESTAMP, VARCHAR, BIGINT})
          .newPreparedStatementCreator(new Object[] {eventData.getName(), eventData.getDescription(), eventData.getTimeZone(), eventData.getFirstDay(), eventData.getLastDay(), eventData.getAbbreviation(), eventData.getMemberGroupId()}), keyHolder);
      Number eventId = keyHolder.getKey();
      logger.info("Created event (ID = " + eventId + ")");
      jdbcTemplate.update(new PreparedStatementCreatorFactory(INSERT_VENUE, new int[] {VARCHAR, VARCHAR, DOUBLE, DOUBLE, VARCHAR, BIGINT})
          .newPreparedStatementCreator(new Object[] {venueData.getName(), venueData.getPostalAddress(), venueData.getLatitude(), venueData.getLongitude(), venueData.getLocationHint(), 1}), keyHolder);
      Number venueId = keyHolder.getKey();
      logger.info("Created vanue (ID = " + venueId + ")");
      jdbcTemplate.update(INSERT_EVENT_VENUE, eventId, venueId);
      jdbcTemplate.update(INSERT_EXTERNAL_EVENT, eventId, eventData.getSourceId(), eventData.getSource(), new Date());
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.PreparedStatementCreatorFactory$PreparedStatementCreatorImpl

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.