/** * Method to perform the actual compilation. Subclasses can override this template method to perform * their own compilation. Invoked after this base class's compilation is complete. */ protected void compileInternal() { this.callMetaDataContext.initializeMetaData(getJdbcTemplate().getDataSource()); // iterate over the declared RowMappers and register the corresponding SqlParameter for (Map.Entry<String, RowMapper<?>> entry : this.declaredRowMappers.entrySet()) { SqlParameter resultSetParameter = this.callMetaDataContext.createReturnResultSetParameter(entry.getKey(), entry.getValue()); this.declaredParameters.add(resultSetParameter); } this.callMetaDataContext.processParameters(this.declaredParameters); this.callString = this.callMetaDataContext.createCallString(); if (logger.isDebugEnabled()) { logger.debug("Compiled stored procedure. Call string is [" + this.callString + "]"); } this.callableStatementFactory = new CallableStatementCreatorFactory(getCallString(), this.callMetaDataContext.getCallParameters()); this.callableStatementFactory.setNativeJdbcExtractor(getJdbcTemplate().getNativeJdbcExtractor()); onCompileInternal(); }
/** * Delegate method to perform the actual compilation. * <p>Subclasses can override this template method to perform their own compilation. * Invoked after this base class's compilation is complete. */ protected void compileInternal() { this.callMetaDataContext.initializeMetaData(getJdbcTemplate().getDataSource()); // Iterate over the declared RowMappers and register the corresponding SqlParameter for (Map.Entry<String, RowMapper<?>> entry : this.declaredRowMappers.entrySet()) { SqlParameter resultSetParameter = this.callMetaDataContext.createReturnResultSetParameter(entry.getKey(), entry.getValue()); this.declaredParameters.add(resultSetParameter); } this.callMetaDataContext.processParameters(this.declaredParameters); this.callString = this.callMetaDataContext.createCallString(); if (logger.isDebugEnabled()) { logger.debug("Compiled stored procedure. Call string is [" + this.callString + "]"); } this.callableStatementFactory = new CallableStatementCreatorFactory(getCallString(), this.callMetaDataContext.getCallParameters()); this.callableStatementFactory.setNativeJdbcExtractor(getJdbcTemplate().getNativeJdbcExtractor()); onCompileInternal(); }
/** * Method to perform the actual compilation. Subclasses can override this template method to perform * their own compilation. Invoked after this base class's compilation is complete. */ protected void compileInternal() { this.callMetaDataContext.initializeMetaData(getJdbcTemplate().getDataSource()); // iterate over the declared RowMappers and register the corresponding SqlParameter for (Map.Entry<String, RowMapper> entry : this.declaredRowMappers.entrySet()) { SqlParameter resultSetParameter = this.callMetaDataContext.createReturnResultSetParameter(entry.getKey(), entry.getValue()); this.declaredParameters.add(resultSetParameter); } this.callMetaDataContext.processParameters(this.declaredParameters); this.callString = this.callMetaDataContext.createCallString(); if (logger.isDebugEnabled()) { logger.debug("Compiled stored procedure. Call string is [" + this.callString + "]"); } this.callableStatementFactory = new CallableStatementCreatorFactory(getCallString(), this.callMetaDataContext.getCallParameters()); this.callableStatementFactory.setNativeJdbcExtractor(getJdbcTemplate().getNativeJdbcExtractor()); onCompileInternal(); }
/** * Overridden method to configure the CallableStatementCreatorFactory * based on our declared parameters. * @see RdbmsOperation#compileInternal() */ @Override protected final void compileInternal() { if (isSqlReadyForUse()) { this.callString = getSql(); } else { List<SqlParameter> parameters = getDeclaredParameters(); int parameterCount = 0; if (isFunction()) { this.callString = "{? = call " + getSql() + "("; parameterCount = -1; } else { this.callString = "{call " + getSql() + "("; } for (SqlParameter parameter : parameters) { if (!(parameter.isResultsParameter())) { if (parameterCount > 0) { this.callString += ", "; } if (parameterCount >= 0) { this.callString += "?"; } parameterCount++; } } this.callString += ")}"; } if (logger.isDebugEnabled()) { logger.debug("Compiled stored procedure. Call string is [" + getCallString() + "]"); } this.callableStatementFactory = new CallableStatementCreatorFactory(getCallString(), getDeclaredParameters()); this.callableStatementFactory.setResultSetType(getResultSetType()); this.callableStatementFactory.setUpdatableResults(isUpdatableResults()); this.callableStatementFactory.setNativeJdbcExtractor(getJdbcTemplate().getNativeJdbcExtractor()); onCompileInternal(); }
/** * Get the {@link CallableStatementCreatorFactory} being used */ protected CallableStatementCreatorFactory getCallableStatementFactory() { return this.callableStatementFactory; }
public BatchCallableStatementCreatorFactory(Template template) { this.template = template; this.sqlParameterList = createParams(); this.callableStatementCreatorFactory = new CallableStatementCreatorFactory(formatSql(), createParams()); }