Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 372
H.BENIZID Avatar asked Apr 22 '26 13:04

H.BENIZID


1 Answers

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.

like image 50
Maciej Kowalski Avatar answered Apr 24 '26 04:04

Maciej Kowalski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!