Calling MySQL Procedures from iBatis

I had some issues this morning calling MySQL Procedures from iBatis. The iBatis documentation is pretty sparse on the subject and I could not find anything useful on the forums. I did eventually find the ‘clincher’ post on a

Assume this (rather brain-dead) stored procedure:

CREATE PROCEDURE increment_total_widgets (widget_key BINARY(20), increment INT)
UPDATE statistics
SET total_widgets = total_widgets + increment
WHERE widget_key = widget_key;

The procedure setup in the iBatis sqlmap file should be as follows:

<procedure id="incrementTotalWidgets" parameterClass="HashMap">
{CALL increment_total_widgets(UNHEX(#widget_key:VARCHAR#), #increment:NUMBER#)}

This looks nothing like the example set out in the iBatis documentation.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: