admin管理员组

文章数量:1404559

We are trying to call a PL/SQL Procedure that runs in a Oracle Database. The complete PL/SQL procedure runs for 10-12 minutes.

With SpringBoot 3.x with Java 21, we use Hibernate to call this Stored Procedure. Following is the code snippet

    /** The entity manager. */
    @PersistenceContext
    EntityManager entityManager;



 @jakarta.transaction.Transactional
    public void callStoredProcedure(String procdurename, Integer jobId) {


        StoredProcedureQuery storedProcedure = entityManager.createStoredProcedureQuery(procdurename)
                .registerStoredProcedureParameter(0, Integer.class, ParameterMode.IN);

        storedProcedure.setParameter(0, jobId);
        try {
            LOGGER.info("Execute Update....... ");
            storedProcedure.executeUpdate();
            LOGGER.info("Execute Update.......End ");
     
        } finally {
            storedProcedure.unwrap(ProcedureOutputs.class).release();
        }

    }

The PL/SQL Procedure in the DB

PROCEDURE stored_Procedure_db(i_job_id in NUMBER) IS
   L_PROC_NAME VARCHAR2(100) := C_MODULE_NAME || '.stored_Procedure_db';
   L_TRCSTRING VARCHAR2(1024);
   l_Step_Name VARCHAR2(20) := 'Test';
 BEGIN
   TRACE_PA.TRACE_PR(L_PROC_NAME, 20, 'Start:' || i_Job_Id, 1);
   tr_objects_pr_primary(i_job_id);
   tr_objects_pr_secondary(i_job_id);
   TRACE_PA.TRACE_PR(L_PROC_NAME, 20, 'Ende:' || i_Job_Id);
 EXCEPTION
   WHEN OTHERS THEN
     begin
       L_TRCSTRING := 'unhandled exception ' || SQLERRM;
       RAISE_APPLICATION_ERROR(-20068, L_TRCSTRING);
     end;
   
 END stored_Procedure_db;

The line TRACE_PR logs entires into a separate DB Table.tr_objects_pr_primary and tr_objects_pr_secondary are in turn another 2 procedures called from this procedure.

In the Database Tables, I can see the trace "TRACE_PA.TRACE_PR(L_PROC_NAME, 20, 'Ende:' || i_Job_Id);" logged. I assume from this that the execution of the PL/SQL procedure is over.

The problem is, the line

**storedProcedure.executeUpdate()** 

from the Java code is still executing and does not end.

Any ideas on what is happening?

本文标签: javaStoredProcedureQuery does not endStack Overflow