Basic stored proc outbound gateway question
How do I call a stored procedure with more than one input parameter?
I'm looking at the Stored Procedures MS sample:
https://github.com/SpringSource/spri...-procedures-ms
What I've done is modify the stored proc to take two varchar arguments rather than one, and I've also altered the StringConversionService.convertToUpperCase method signature to take two string arguments, e.g.:
Code:
/**
* Converts a String to Upper Case.
*
* @param firstName First name
* @param lastName Last name
* @return The converted upper case string (firstName lastName)
*/
String convertToUpperCase(String firstName, String lastName);
What I can't figure out is how to set up my int-jdbc:stored-proc-outbound-gateway configuration so that Spring knows how to map the method arguments to the stored procedure parameters.
Code:
<int-jdbc:stored-proc-outbound-gateway
id="outbound-gateway-procedure" request-channel="procedureRequestChannel"
data-source="dataSource" stored-procedure-name="CAPITALIZE_STRING"
expect-single-result="true">
<int-jdbc:parameter name="pfirstName" expression="[WHAT DO I PUT HERE?]" />
<int-jdbc:parameter name="plastName" expression="[WHAT DO I PUT HERE?]" />
</int-jdbc:stored-proc-outbound-gateway>
Nasty hack of the example's stored procedure, just in case it is relevant:
Code:
ALTER PROCEDURE [dbo].[CAPITALIZE_STRING]
@pfirstName VARCHAR(50),
@plastName VARCHAR(50) OUTPUT
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
select @plastName = upper(@pfirstName + ' ' + @plastName);
END
GO
Best wishes,
Ben