title: How to return from a long-running procedure call in Spring MVC?
body: <p>I want to call an Oracle PL/SQL procedure from Spring. The procedure takes a lot of time so I would like it to be executed in the background (asynchronously) and briefly return from the DAO method and controller.
  What is the most elegant method to return from a long-running procedure? I do not have to track its execution in the request which calls the procedure.</p>
  
  <p>What currently I have is:</p>
  
  <pre><code>@Override
  public void submitJob(final Integer param1, final String param2, final Integer param3) {
      jdbcTemplate.execute(
          new CallableStatementCreator() {
              public CallableStatement createCallableStatement(Connection con) throws SQLException{
                  CallableStatement cs = con.prepareCall("{call PCKG.MY_PROC(?, NULL, ?, ?)}");
                  cs.setInt(1, param1);
                  cs.setString(2, param2);
                  cs.setInt(3, param3);
                  return cs;
              }
          },
          new CallableStatementCallback() {
              public Object doInCallableStatement(CallableStatement cs) throws SQLException{
                  cs.execute();
                  return null;
              }
          }
      );
  }
  </code></pre>