List of usage examples for org.springframework.jdbc.core.simple SimpleJdbcCall declareParameters
@Override
public SimpleJdbcCall declareParameters(SqlParameter... sqlParameters)
From source file:rapture.repo.jdbc.JDBCStructuredStore.java
@Override public StoredProcedureResponse callProcedure(CallingContext context, String procName, StoredProcedureParams params) {//from w w w .j av a 2 s .co m // TODO RAP-3548 Need to check entitlements SimpleJdbcCall call = new SimpleJdbcCall(jdbc).withProcedureName(procName) .withoutProcedureColumnMetaDataAccess(); MapSqlParameterSource paramSource = new MapSqlParameterSource(); Map<String, Object> inParams = (params == null) ? null : params.getInParams(); Map<String, Integer> outParams = (params == null) ? null : params.getOutParams(); Map<String, Object> inOutParams = (params == null) ? null : params.getInOutParams(); if (inParams != null) { // Declare Parameters Map<String, Integer> inParamTypes = getInputParamTypes(inParams); for (Map.Entry<String, Integer> entry : inParamTypes.entrySet()) { call.declareParameters(new SqlParameter(entry.getKey(), entry.getValue())); } // Give Input Parameters for (Map.Entry<String, Object> entry : inParams.entrySet()) { paramSource.addValue(entry.getKey(), entry.getValue()); } } if (inOutParams != null) { Map<String, Integer> inOutParamTypes = getInputParamTypes(inOutParams); for (Map.Entry<String, Integer> entry : inOutParamTypes.entrySet()) { call.declareParameters(new SqlInOutParameter(entry.getKey(), entry.getValue())); } // Give Input Parameters for (Map.Entry<String, Object> entry : inOutParams.entrySet()) { paramSource.addValue(entry.getKey(), entry.getValue()); } } if (outParams != null) { for (Map.Entry<String, Integer> entry : outParams.entrySet()) { call.declareParameters(new SqlOutParameter(entry.getKey(), entry.getValue())); } } try { return packageStoredProcedureReturn(call.execute(paramSource), true); } catch (BadSqlGrammarException e) { log.error(e.getSQLException()); return packageStoredProcedureReturn(null, false); } }