Announcement Announcement Module
Collapse
No announcement yet.
commit transaction & restart transaction inside transaction advice Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • commit transaction & restart transaction inside transaction advice

    Hi,

    For our application we have an architecture using facades, which use services.
    Our transactions are defined through an advice for each facade method.
    This is appropriate for most cases.

    Of course there's an exception to this: there is one service method (from a workflowservice), when executed, which will trigger execution of (automatic) new workflow tasks. These (automatic) tasks should ideally all run in their own transaction.

    Is there a possibility to have the existing transaction committed by some kind of advice when that service method is called, and immediately start a new transaction?

    So now we have (pseudo):

    Code:
    start transaction A
    facademethod() {
      ...
      workflow.endTask(task) {
         for each (task.getAutomaticTasks()) {
            task.execute();
         }
      }
      ...
    }
    commit transaction A
    What we'd like to have:

    Code:
    start Transaction A
    facademethod() {
      ...
      commit transaction A
      workflow.endTask(task) {
         for each (task.getAutomaticTasks()) {
            start transaction X
            task.execute();
            commit transaction X
         }
      }
      start transaction B
      ...
    }
    end transaction B
    Any ideas or suggestions? The biggest problem is some of the automatic tasks call an external service, which needs data from the database, but since the transaction isn't committed yet, the external service has no access to the data in the db yet.

    Thanks in advance

  • #2
    You just describe the use case of the transactional REQUIRES_NEW propagation.

    Comment

    Working...
    X