0

Here is my working code:

    public interface CandidatRepository extends JpaRepository<Candidat, String> {
    
        @Procedure(procedureName = "garnuche.INSCRIPTION_TEST")
         String inscrire(String nom);
    
    }
CREATE OR REPLACE PROCEDURE GARNUCHE.INSCRIPTION_TEST (
NOM IN VARCHAR2,
STATUS OUT VARCHAR2) AS 
BEGIN 
    INSERT INTO GARNUCHE.CANDIDAT_TEST (NOM) VALUES (NOM); 
    STATUS := '99';
END;

Now I would like to have 2 out parameters, so I try this:

     @Procedure(procedureName = "garnuche.INSCRIPTION_TEST")
        Map<String, ?> inscrire(String nom);
     CREATE OR REPLACE PROCEDURE GARNUCHE.INSCRIPTION_TEST (
        NOM IN VARCHAR2,
        STATUS OUT VARCHAR2,
        STATUS2 OUT VARCHAR2) AS 
        BEGIN 
            INSERT INTO GARNUCHE.CANDIDAT_TEST (NOM) VALUES (NOM); 
            STATUS := '99';
            STATUS2 := '98';
        END;

But I get this error:

    org.hibernate.procedure.ParameterTypeException: Could not determine ProcedureCall parameter bind type - out (2)

Note: I would like to avoid declaring all my parameters with (the reason that the target procedure will have 200 parameters...):

    @NamedStoredProcedureQuery(
        name = "Candidat.inscrire",
        procedureName = "garnuche.INSCRIPTION_TEST",
        parameters = {
            @StoredProcedureParameter(mode = ParameterMode.IN, name = "NOM", type = String.class),
            @StoredProcedureParameter(mode = ParameterMode.OUT, name = "STATUS", type = String.class),
            @StoredProcedureParameter(mode = ParameterMode.OUT, name = "STATUS2", type = String.class)
        }

or

    query.registerStoredProcedureParameter("NOM", String.class, ParameterMode.IN);
2
  • "I would like to avoid declaring all my parameters" In the time it has taken to write this question and wait for an answer you could have copy-pasted the procedure's signature and edited it to list all the parameters - just declare all the parameters.
    – MT0
    Commented Jul 10 at 7:20
  • @MT0 there is a context to that question. I work for a client that has many procedures with undreds of parameters... That is why I simplify the question, to find a solution that will save me days of work.
    – Tyvain
    Commented Jul 10 at 21:02

0

Browse other questions tagged or ask your own question.