Spring Data JPA NamedStoredProcedureQuery Multiple Out Parameters

It looks like @Procedure expects only one OUT parameter which is binded directly to the method return type…

To handle multiple OUT params you can use the JPA API directly:

StoredProcedureQuery proc = em.createNamedStoredProcedureQuery("plus1");

proc.setParameter("arg", 1);
proc.execute();
Integer res1 = (Integer) proc.getOutputParameterValue("res1");
Integer res2 = (Integer) proc.getOutputParameterValue("res2");
...

Leave a Comment

tech