List of usage examples for org.springframework.jdbc.object StoredProcedure getSql
@Nullable
public String getSql()
From source file:org.codehaus.grepo.procedure.cache.ProcedureCachingStrategyImpl.java
/** * {@inheritDoc}//from ww w .j ava2s . c om */ public void addToCache(final StoredProcedure storedProcedure, final String cacheName) { if (storedProcedure != null) { if (StringUtils.isEmpty(cacheName)) { String msg = String.format("Unable to cache procedure ('%s'), because cacheName is empty", storedProcedure.getSql()); throw new ProcedureCachingException(msg); } if (cache.containsKey(cacheName)) { String msg = String.format( "Unable to cache procedure ('%s'), because entry already exists for cacheName '%s'", storedProcedure.getSql(), cacheName); logger.warn(msg); } // add to cache cache.put(cacheName, storedProcedure); } }
From source file:org.codehaus.grepo.procedure.repository.GenericProcedureRepositoryImpl.java
/** * Execute the procedure.// w w w . j a v a 2s .co m * * @param pmpi The method parameter info. * @param genericProcedure The annotation. * @return Returns the result map of the procedure call. */ protected Map<String, Object> executeProcedure(final ProcedureMethodParameterInfo pmpi, GenericProcedure genericProcedure) { TransactionCallback<Object> callback = new TransactionCallback<Object>() { public Object doInTransaction(final TransactionStatus status) { ProcedureExecutionContext context = createProcedureExecutionContext(); StoredProcedure sp = prepareProcedure(pmpi, context); Map<String, Object> input = generateInputMap(pmpi, context); if (logger.isDebugEnabled()) { logger.debug("About to execute procedure: {}", sp.getSql()); logger.debug("Using input map: {}", input); } Object result = sp.execute(input); logger.debug("Procedure result is '{}'", result); return result; } }; return executeCallback(callback, genericProcedure.isReadOnly()); }