title: jpa calling stored procedure with output cursor
body: <p>I am trying to call an oracle stored procedure that returns an output cursor usign JPA as follows</p>
  
  <pre><code>  create or replace PROCEDURE stored_proc(ret_cursor OUT sys_refcursor, inputParam IN NUMBER)
     -- body 
    END stored_proc;
  
    @Entity
    @NamedNativeQuery(name = "callStoredProc",  
           resultClass = Result.class,  
           query = "{call stored_proc(?,:inputParam)}",  
          callable = true,
          readOnly=true
    )
    public class Result{
      // map the result set params.
    }  
  
    //JPA code to get result set 
    List&lt;Result&gt; resultList =  getEntityManager().createNamedQuery("callStoredProc")
                                          .setParameter("inputParam", inputParam)
                              .getResultList();
  </code></pre>
  
  <p>This all works good but, if I try to alter the procedure definition to change the cursor as 
  second parameter and make corresponding parameter changes in JPA code as well , it doesn't work. I get the error</p>
  
  <p>[4/30/12 11:42:30:505 CDT] 00000025 SystemErr     R Caused by: java.sql.SQLException: ORA-06550: line 1, column 7:
  PLS-00306: wrong number or types of arguments in call to 'stored_proc'</p>
  
  <pre><code>    create or replace PROCEDURE stored_proc(inputParam IN NUMBER,ret_cursor OUT sys_refcursor)
  </code></pre>
  
  <p>Should the output cursor be always the first parameter in the stored proc when using JPA? Is there a workaround for it?</p>