Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-26227

The storeAll method in OfBiz always runs in the ExplcitCommitSqlProcessor, however if you call this with no transaction scope, a new transaction is not always started.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: High High
    • None
    • 4.4, 5.0
    • None

      storeAll is designed to be transactional, as you may be storing more than 1 entity. However there is a bug in that if the list contains only a single entity no transaction is ever started, in these cases the transaction is only committed on the close of the connection, which only happens when the finalizer is called, as the close takes place in the explicit committ. This is causing the linked issue failure.

      This is the code from GenericDelegator

      boolean beganTransaction = false;
      int numberChanged = 0;
      
      try {
          // if there are multiple helpers and no transaction is active, begin one
          if (valuesPerHelper.size() > 1) {
          beganTransaction = TransactionUtil.begin();
      }
      ..snip
      TransactionUtil.commit(beganTransaction);
      

      in TransactionUtil.commit, you simply noop if beganTransaction is false (which it will be for single entities)

              jwinters tier-0 grump
              jwinters tier-0 grump
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: