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