Make sure the procedure itself doesn't commit. Make sure sure the connection's autocommit is turned off, make sure Spring doesn't commit anything until your loop is finished.