Stored procedure name changed during execution using Spring Data

I need to call an Oracle stored procedure using Spring annotation @Procedure in my Repository as follows:

    @Procedure(name = "SECURITE.P_MAJ_DROITFAM")
    public void updateDroitFamille (@Param("v_id_fam") Long idFamille,@Param("v_action_type") Integer cas,@Param("v_user") String userName);

Error log :

Hibernate: {call updateDroitFamille (?,?,?)} 15: 46: 39,946 – ERROR – SqlExceptionHelper.logExceptions: 146 – ORA-06550: Line 1, column 7: PLS-00201: The identifier ‘UPDATEDROITFAMILLE’ must be declared

but procedure name is P_MAJ_DROITFAM and not updateDroitFamille
The problem is that the procedure name has been changed during execution!!? any ideas?

Answer

What you need to do is put additional configuration on one of your entities do declare the definition of your procedure first in the application:

@NamedStoredProcedureQuery(name = "P_MAJ_DROITFAM", procedureName = "SECURITE.P_MAJ_DROITFAM", parameters = {
        @StoredProcedureParameter(mode = ParameterMode.IN, name = "v_id_fam", type = Long.class),
        @StoredProcedureParameter(mode = ParameterMode.IN, name = ""v_action_type", type = Integer.class) },
        @StoredProcedureParameter(mode = ParameterMode.IN, name = ""v_user", type = Integer.class) })
public class MyEntity{

Then in the repository you would call like:

@Procedure(name = "P_MAJ_DROITFAM")
    public void updateDroitFamille (@Param("v_id_fam") Long idFamille,@Param("v_action_type") Integer cas,@Param("v_user") String userName);

You can keep the name of the method.

Leave a Reply

Your email address will not be published. Required fields are marked *