private SimpleJdbcCall createSimpleJdbcCall(String storedProcedureName) { final SimpleJdbcCall simpleJdbcCall = new SimpleJdbcCall(this.dataSource); if (this.isFunction) { simpleJdbcCall.withFunctionName(storedProcedureName); } else { simpleJdbcCall.withProcedureName(storedProcedureName); } if (this.ignoreColumnMetaData) { simpleJdbcCall.withoutProcedureColumnMetaDataAccess(); } simpleJdbcCall.declareParameters(this.sqlParameters.toArray(new SqlParameter[this.sqlParameters.size()])); if (!this.returningResultSetRowMappers.isEmpty()) { for (Entry<String, RowMapper<?>> mapEntry : this.returningResultSetRowMappers.entrySet()) { simpleJdbcCall.returningResultSet(mapEntry.getKey(), mapEntry.getValue()); } } if (this.returnValueRequired) { simpleJdbcCall.withReturnValue(); } simpleJdbcCall.getJdbcTemplate().setSkipUndeclaredResults(this.skipUndeclaredResults); return simpleJdbcCall; }
protected <T> SimpleJdbcCall getCall(String procedureName, CallCreator callCreator, RowMapper<T> mapper) { SimpleJdbcCall call = callsMap.get(procedureName); if (call == null) { call = callCreator.createCall(); call.compile(); callsMap.putIfAbsent(procedureName, call); } else if (mapper != null) { call.returningResultSet(RETURN_VALUE_PARAMETER, mapper); } return call; }
@Override public List callProcedureQueryListBeans(String procedureName, Map<String, Object> inParameters, Class<?> outBeansType) { jdbcCall = jdbcCall.withProcedureName(procedureName); if (outBeansType != null) { jdbcCall = jdbcCall.returningResultSet("list_beans", generateRowMapper(outBeansType)); } List list = (List) jdbcCall.execute(inParameters).get("list_beans"); logger.info("-- SQL参数:[{}]", inParameters); logger.info("-- 响应条目:[{}]", list.size()); return list; }
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; }; }
private SimpleJdbcCall createSimpleJdbcCall(String storedProcedureName) { final SimpleJdbcCall simpleJdbcCall = new SimpleJdbcCall(this.dataSource); if (this.isFunction) { simpleJdbcCall.withFunctionName(storedProcedureName); } else { simpleJdbcCall.withProcedureName(storedProcedureName); } if (this.ignoreColumnMetaData) { simpleJdbcCall.withoutProcedureColumnMetaDataAccess(); } simpleJdbcCall.declareParameters(this.sqlParameters.toArray(new SqlParameter[this.sqlParameters.size()])); if (!this.returningResultSetRowMappers.isEmpty()) { for (Entry<String, RowMapper<?>> mapEntry : this.returningResultSetRowMappers.entrySet()) { simpleJdbcCall.returningResultSet(mapEntry.getKey(), mapEntry.getValue()); } } if (this.returnValueRequired) { simpleJdbcCall.withReturnValue(); } simpleJdbcCall.getJdbcTemplate().setSkipUndeclaredResults(this.skipUndeclaredResults); return simpleJdbcCall; }