/** * Execute the Stored Procedure using the passed in {@link Message} as a source * for parameters. * * @param input The message is used to extract parameters for the stored procedure. * @return A map containing the return values from the Stored Procedure call if any. */ private Map<String, Object> executeStoredProcedureInternal(Object input, String storedProcedureName) { Assert.notNull(this.sqlParameterSourceFactory, "Property sqlParameterSourceFactory " + "was Null. Did you call afterPropertiesSet()?"); SimpleJdbcCallOperations localSimpleJdbcCall = obtainSimpleJdbcCall(storedProcedureName); SqlParameterSource storedProcedureParameterSource = this.sqlParameterSourceFactory.createParameterSource(input); return localSimpleJdbcCall.execute(storedProcedureParameterSource); }
@Override public Integer getSystemStatisticsValue(String entity, String status) { MapSqlParameterSource parameterSource = new CustomMapSqlParameterSource(dbEngineDialect) .addValue("entity", entity) .addValue("status", status); RowMapper<Integer> mapper = (rs, rowNum) -> rs.getInt("val"); Map<String, Object> dbResults = dbEngineDialect .createJdbcCallForQuery(jdbcTemplate) .withProcedureName("Getsystem_statistics") .returningResultSet("RETURN_VALUE", mapper) .execute(parameterSource); return (Integer) DbFacadeUtils.asSingleResult((List<?>) dbResults.get("RETURN_VALUE")); } }
private CallCreator createCallForRead(final String procedureName, final RowMapper<?> mapper, final MapSqlParameterSource parameterSource) { return () -> { SimpleJdbcCall call = (SimpleJdbcCall) dialect.createJdbcCallForQuery(jdbcTemplate).withProcedureName(procedureName); call.returningResultSet(RETURN_VALUE_PARAMETER, mapper); // Pass mapper information (only parameter names) in order to supply all the needed // metadata information for compilation. call.getInParameterNames().addAll( SqlParameterSourceUtils.extractCaseInsensitiveParameterNames(parameterSource).keySet()); return call; }; }
/** * Execute the Stored Procedure using the passed in {@link Message} as a source * for parameters. * * @param input The message is used to extract parameters for the stored procedure. * @return A map containing the return values from the Stored Procedure call if any. */ private Map<String, Object> executeStoredProcedureInternal(Object input, String storedProcedureName) { Assert.notNull(this.sqlParameterSourceFactory, "Property sqlParameterSourceFactory " + "was Null. Did you call afterPropertiesSet()?"); SimpleJdbcCallOperations localSimpleJdbcCall = obtainSimpleJdbcCall(storedProcedureName); SqlParameterSource storedProcedureParameterSource = this.sqlParameterSourceFactory.createParameterSource(input); return localSimpleJdbcCall.execute(storedProcedureParameterSource); }