Home > Software engineering >  How to save and view changes in DB immediately?
How to save and view changes in DB immediately?

Time:10-01

I'm developing an app that shows process status, the following structure [ProcessId, Message] is stored in a log table.

  • First, the user run a process, log row is created (ID, 'STARTED').
  • Then, the process make some tasks, when each task is finished a new row is created (ID,'FINISH TASK 1'),(ID,'FINISH TASK 2') ...
  • Finally, when the process is finished the last row is crated (ID,'FNISH PROCESS').

Everything works well, my problem is that all the log rows are created when process is finished. I want to create and view on DB the changes while the process is running.

Is it possible to make commit inside a process?

I'm using Java 8, Hibernate 5.6.7 and DeltaSpike 1.9.5, DB Oracle 12c

CodePudding user response:

Just use

  Propagation.REQUIRES_NEW and Isolation.READ_COMMITTED

CodePudding user response:

I don't know what you mean by "commit inside a process", but what you can do is to use the transaction isolation level READ_UNCOMMITTED for this particular UI where you need to access data that isn't committed yet.

  • Related