use of org.springframework.jdbc.core.simple.SimpleJdbcCallOperations in project spring-integration by spring-projects.
the class StoredProcExecutor method obtainSimpleJdbcCall.
private SimpleJdbcCallOperations obtainSimpleJdbcCall(String storedProcedureName) {
if (guavaPresent) {
return this.guavaCacheWrapper.jdbcCallOperationsCache.getUnchecked(storedProcedureName);
} else {
SimpleJdbcCallOperations operations = this.jdbcCallOperationsMap.get(storedProcedureName);
if (operations == null) {
synchronized (this.jdbcCallOperationsMapMonitor) {
operations = this.jdbcCallOperationsMap.get(storedProcedureName);
if (operations == null) {
operations = createSimpleJdbcCall(storedProcedureName);
this.jdbcCallOperationsMap.put(storedProcedureName, operations);
}
}
}
return operations;
}
}
use of org.springframework.jdbc.core.simple.SimpleJdbcCallOperations in project spring-integration by spring-projects.
the class StoredProcExecutorTests method mockTheOperationsCache.
private void mockTheOperationsCache(final StoredProcExecutor storedProcExecutor) {
Object cache = TestUtils.getPropertyValue(storedProcExecutor, "guavaCacheWrapper.jdbcCallOperationsCache.localCache");
new DirectFieldAccessor(cache).setPropertyValue("defaultLoader", new CacheLoader<String, SimpleJdbcCallOperations>() {
@Override
public SimpleJdbcCall load(String storedProcedureName) {
return mock(SimpleJdbcCall.class);
}
});
}
use of org.springframework.jdbc.core.simple.SimpleJdbcCallOperations in project spring-integration by spring-projects.
the class StoredProcExecutor method executeStoredProcedureInternal.
/**
* 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);
}
Aggregations