Following the previous post, I wondered if there's a more elegant way to call a function. It turns out there is and it's based on CallableStatement:
int value = jdbcOperations.execute(
new CallableStatementCreator() {
// ...
},
new CallableStatementCallback<Integer>() {
// ...
}
);
The CallableStatementCreator sets up the statement and the CallableStatementCallback