Hi,

Le 15/07/2014 10:12, Marc von der Brüggen a écrit :
Hello Nicolas,

thank you very much for your help.

I tried it:

Debug.logVerbose("### Store List Prices ("+productPrices.size()+") ###", MODULE);
        Transaction transaction = null;
        transaction = TransactionUtil.suspend();
        boolean transactionBegan = TransactionUtil.begin();
        delegator.storeAll(productPrices);
        TransactionUtil.commit(transactionBegan);
        TransactionUtil.resume(transaction);
        TransactionUtil.commit();
Debug.logVerbose("### List Prices Stored ("+productPrices.size()+") ###", MODULE);

but the output is still the same:

[java] 2014-07-15 09:58:54,831 (default-invoker-Thread-6) [ OfbizPriceImporter.java:688:DEBUG] ### Store List Prices (1234) ### [java] 2014-07-15 09:58:54,831 (default-invoker-Thread-6) [ TransactionUtil.java:348:WARN ] No transaction in place, so not suspending.
I'm really surprising on that ! If you haven't transaction available, your service don't open a transaction or you have disable on the entity engine your transaction manager.
In this case just :

        boolean transactionBegan = TransactionUtil.begin();
        delegator.storeAll(productPrices);
        TransactionUtil.commit();

works.
[java] 2014-07-15 09:58:55,990 (default-invoker-Thread-6) [ TransactionUtil.java:210:WARN ] [TransactionUtil.commit] Not committing transaction, status is No Transaction (6) [java] 2014-07-15 09:58:55,990 (default-invoker-Thread-6) [ OfbizPriceImporter.java:696:DEBUG] ### List Prices Stored (1234) ###


Kind regards
Marc


Am 10.07.2014 15:12, schrieb Nicolas Malin:
Ok I understand.

If you run a commit in your code at the service end, the transaction has been already commited

So, open a new transaction like this  :

Transaction transaction = null;
        try {
            transaction = TransactionUtil.suspend();
            boolean transactionBegan = TransactionUtil.begin();
            delegator.storeAll(listOfGenericValues);
            TransactionUtil.commit(transactionBegan );
            TransactionUtil.resume(transaction);
        } catch (YourExceptionLevel e) {
            Debug.logError(e, module);
            TransactionUtil.rollback();
            TransactionUtil.resume(transaction);
        }


Le 10/07/2014 14:59, Marc von der Brüggen a écrit :
Hi Nicolas,

I didn't set use-transaction="false", so that the service can handle the transactions by itself.

Before I tried

delegator.storeAll(listOfGenericValues);
TransactionUtil.commit();

it looked like this:

boolean transactionBegan = TransactionUtil.begin();
delegator.storeAll(listOfGenericValues);
TransactionUtil.commit(transactionBegan );

However, transactionBegan was always false.


Kind regards
Marc



Am 10.07.2014 11:59, schrieb Nicolas Malin:
Do you open a transaction before ?

TransactionUtil.begin();
delegator.storeAll(listOfGenericValues);
TransactionUtil.commit();

Nicolas

Le 10/07/2014 11:18, Marc von der Brüggen a écrit :
Hello,

does delegator.storeAll(listOfGenericValues) always perform a commit?

I want to make sure the data is committed, but if I do the following:

delegator.storeAll(listOfGenericValues);
TransactionUtil.commit();

I receive a warning:
[java] 2014-07-10 10:20:55,841 (default-invoker-Thread-6) [ TransactionUtil.java:210:WARN ] [TransactionUtil.commit] Not committing transaction, status is No Transaction (6)


Thank you very much!


Kind regards
Marc








Reply via email to