I’m trying to execute a procedure in Oracle, but using the code as I do in Postgres, which works very well.
However, in Oracle the procedure works, testing it with plSql, but in Jmix it returns an error.
I’ve tried with getResultStream, executeUpdate() and each one returns a different error.
Below I will put the code for calling the procedure, this procedure is inserted and updates records in the database.
I ask for help in knowing what is the best way, or the correct way to call this procedure.
private void atualizarListaEnvios(String filial, String tipoInfo) { try { //TODO:a função continua retornando -1 //String sComando = "begin REDEMAIS.RM_REVISAR_DELIVERY(PCODFILIAL, PCODTIPO); end;"; String sComando = """ declare retvar varchar2(4); begin REDEMAIS.RMDELIVERY.REGISTROSATUALIZAR('<PCODFILIAL>',<PCODTIPO>); end; """; sComando = sComando.replace("<PCODFILIAL>", filial); sComando = sComando.replace("<PCODTIPO>", tipoInfo); em.createNativeQuery(sComando).executeUpdate(); } catch (Exception e) { log.error(e.getMessage()); e.printStackTrace(); throw new RuntimeException("Erro ao atualizar lista de envios: " + e.getMessage()); } }
below is the error that returns when executing it this way
2025-05-02T12:19:07.871-03:00 ERROR 30604 --- [nio-9898-exec-8] br.com.pedromas.prm.app.Delivery :
Exception Description: No transaction is currently active
jakarta.persistence.TransactionRequiredException:
Exception Description: No transaction is currently active
at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionWrapper.throwCheckTransactionFailedException(EntityTransactionWrapper.java:93)
at org.eclipse.persistence.internal.jpa.transaction.EntityTransactionWrapper.checkForTransaction(EntityTransactionWrapper.java:53)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.checkForTransaction(EntityManagerImpl.java:2174)
at org.eclipse.persistence.internal.jpa.QueryImpl.executeUpdate(QueryImpl.java:296)
at io.jmix.eclipselink.impl.JmixEclipseLinkQuery.executeUpdate(JmixEclipseLinkQuery.java:304)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.springframework.orm.jpa.SharedEntityManagerCreator$DeferredQueryInvocationHandler.invoke(SharedEntityManagerCreator.java:419)
at jdk.proxy2/jdk.proxy2.$Proxy222.executeUpdate(Unknown Source)