I was running a stored procedure with Springs SimpleJdbcCall
like this:
SimpleJdbcCall jdbcCall = new SimpleJdbcCall(jdbcTemplate).withProcedureName("example_proc");
jdbcCall.execute();
// do other stuff on other subsystems
// the sysout below is just an example - the real scenario was somewhat different
System.out.println("Supposedly after the end of the stored procedure call");
The stored procedure was running for a long time, and it was overlapped with the stuff that was supposed to happen after that.
The stored procedure was written in Microsoft's SQL Server dialect, and looked like this:
CREATE PROCEDURE example_proc
AS
BEGIN
INSERT INTO example_table_1 SELECT * FROM example_table_2
UPDATE example_table_1 SET col1 = 'a' WHERE ...
END
The question is: how to make sure the SimpleJdbcCall
waits until the stored procedure finishes?