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
版权声明:本文标题:java - StoredProcedureQuery does not end - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744824846a2626999.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论