You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Marc von der Brüggen <mb...@zyres.com> on 2014/07/10 11:18:07 UTC

is delegator.storeAll() always committed?

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


Re: is delegator.storeAll() always committed?

Posted by Adrian Crum <ad...@sandglass-software.com>.
Be very careful when writing your own transaction handling code! There 
are a lot of things that can go wrong and you can end up with 
unpredictable results. That is why the framework handles those details 
for you.

No, you do not "close" a transaction. You either commit it or roll it back.


Adrian Crum
Sandglass Software
www.sandglass-software.com

On 7/21/2014 1:34 PM, Marc von der Brüggen wrote:
> Hi,
>
> I disabled the service's transaction
>
>      use-transaction="false"
>
> and handle it manually. It seems to be fine, now.
>
>              boolean transactionBegan = TransactionUtil.begin();
>              Debug.logVerbose("transactionBegan = "+transactionBegan,
> MODULE);
>              delegator.removeByCondition("TableA", completeCondition);
>              TransactionUtil.commit(transactionBegan);
>              Debug.logVerbose("transactionBegan = "+transactionBegan,
> MODULE);
>              Debug.logVerbose("Deleting from tableA", MODULE);
>
>              transactionBegan = TransactionUtil.begin();
>              delegator.removeByCondition("TableB", completeCondition);
>              TransactionUtil.commit(transactionBegan);
>              Debug.logVerbose("Deleting from tableB", MODULE);
>
> My output is:
> transactionBegan = true
> transactionBegan = true
> Deleting from tableA
> Deleting from tableB
>
> Do I have to close the transaction after a commit and what is the
> correct way?
> Call TransactionUtil.suspend() and
> TransactionUtil.cleanSuspendedTransactions()?
>
> Thank you very much!
>
>
> Kind regards
> Marc
>
>
>
> Am 15.07.2014 11:51, schrieb Nicolas Malin:
>> 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
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
>

Re: is delegator.storeAll() always committed?

Posted by Youssef Khaye <y....@unionsmarket.com>.
hi Marc,
here is this the definition of "use-trasaction"
<<
If set to true and there is no transaction already in place
  the Service Engine will begin one. If set to false or there is a
  transaction already in place the Service Engine will do
  nothing (this also means that if set to false and a
  transaction is already in place it will do nothing).
 >>
from that definition we are not sure that there is no transction for 
current service.

what is the problème with your output ?
did u check table to see if record was realy deleted or not ?
I used to suspend a Tx (TransactionUtil.suspend() return current Tx if 
there is one) and then call resume after my code.

       +  Transaction currentTx = TransactionUtil.suspend();
             boolean transactionBegan = TransactionUtil.begin();
             Debug.logVerbose("transactionBegan = "+transactionBegan, 
MODULE);
             delegator.removeByCondition("TableA", completeCondition);
             TransactionUtil.commit(transactionBegan);
             Debug.logVerbose("transactionBegan = "+transactionBegan, 
MODULE);
             Debug.logVerbose("Deleting from tableA", MODULE);

             transactionBegan = TransactionUtil.begin();
             delegator.removeByCondition("TableB", completeCondition);
             TransactionUtil.commit(transactionBegan);
             Debug.logVerbose("Deleting from tableB", MODULE);
     +     if(UtilValidate.isNotEMpty(currentTx))
     +           TransactionUtil.resume(currentTx);

Le 21/07/2014 14:34, Marc von der Brüggen a écrit :
> Hi,
>
> I disabled the service's transaction
>
>     use-transaction="false"
>
> and handle it manually. It seems to be fine, now.
>
>             boolean transactionBegan = TransactionUtil.begin();
>             Debug.logVerbose("transactionBegan = "+transactionBegan, 
> MODULE);
>             delegator.removeByCondition("TableA", completeCondition);
>             TransactionUtil.commit(transactionBegan);
>             Debug.logVerbose("transactionBegan = "+transactionBegan, 
> MODULE);
>             Debug.logVerbose("Deleting from tableA", MODULE);
>
>             transactionBegan = TransactionUtil.begin();
>             delegator.removeByCondition("TableB", completeCondition);
>             TransactionUtil.commit(transactionBegan);
>             Debug.logVerbose("Deleting from tableB", MODULE);
>
> My output is:
> transactionBegan = true
> transactionBegan = true
> Deleting from tableA
> Deleting from tableB
>
> Do I have to close the transaction after a commit and what is the 
> correct way?
> Call TransactionUtil.suspend() and 
> TransactionUtil.cleanSuspendedTransactions()?
>
> Thank you very much!
>
>
> Kind regards
> Marc
>
>
>
> Am 15.07.2014 11:51, schrieb Nicolas Malin:
>> 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
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
>


Re: is delegator.storeAll() always committed?

Posted by Marc von der Brüggen <mb...@zyres.com>.
Hi,

I disabled the service's transaction

     use-transaction="false"

and handle it manually. It seems to be fine, now.

             boolean transactionBegan = TransactionUtil.begin();
             Debug.logVerbose("transactionBegan = "+transactionBegan, 
MODULE);
             delegator.removeByCondition("TableA", completeCondition);
             TransactionUtil.commit(transactionBegan);
             Debug.logVerbose("transactionBegan = "+transactionBegan, 
MODULE);
             Debug.logVerbose("Deleting from tableA", MODULE);

             transactionBegan = TransactionUtil.begin();
             delegator.removeByCondition("TableB", completeCondition);
             TransactionUtil.commit(transactionBegan);
             Debug.logVerbose("Deleting from tableB", MODULE);

My output is:
transactionBegan = true
transactionBegan = true
Deleting from tableA
Deleting from tableB

Do I have to close the transaction after a commit and what is the 
correct way?
Call TransactionUtil.suspend() and 
TransactionUtil.cleanSuspendedTransactions()?

Thank you very much!


Kind regards
Marc



Am 15.07.2014 11:51, schrieb Nicolas Malin:
> 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
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>>
>


-- 
Marc von der Brüggen
Software-Entwickler
    
ZYRES digital media systems GmbH
Stuttgarter Straße 25 60329 Frankfurt am Main
Phone +49 (0)69 98 55 99 - 23
Fax   +49 (0)69 98 55 99 - 11

Firmensitz: Stuttgarter Straße 25 60329 Frankfurt am Main
Registergericht: Amtsgericht Frankfurt am Main, HRB 76374
Geschäftsführer: Sebastian Schirmer

http://www.zyres.com/



Re: is delegator.storeAll() always committed?

Posted by Nicolas Malin <ma...@librenberry.net>.
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
>>>>>
>>>>
>>>
>>>
>>
>
>


Re: is delegator.storeAll() always committed?

Posted by Marc von der Brüggen <mb...@zyres.com>.
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.
      [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
>>>>
>>>
>>
>>
>


-- 
Marc von der Brüggen
Software-Entwickler
    
ZYRES digital media systems GmbH
Stuttgarter Straße 25 60329 Frankfurt am Main
Phone +49 (0)69 98 55 99 - 23
Fax   +49 (0)69 98 55 99 - 11

Firmensitz: Stuttgarter Straße 25 60329 Frankfurt am Main
Registergericht: Amtsgericht Frankfurt am Main, HRB 76374
Geschäftsführer: Sebastian Schirmer

http://www.zyres.com/



Re: is delegator.storeAll() always committed?

Posted by Nicolas Malin <ma...@librenberry.net>.
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
>>>
>>
>
>


Re: is delegator.storeAll() always committed?

Posted by Marc von der Brüggen <mb...@zyres.com>.
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
>>
>


-- 
Marc von der Brüggen
Software-Entwickler
    
ZYRES digital media systems GmbH
Stuttgarter Straße 25 60329 Frankfurt am Main
Phone +49 (0)69 98 55 99 - 23
Fax   +49 (0)69 98 55 99 - 11

Firmensitz: Stuttgarter Straße 25 60329 Frankfurt am Main
Registergericht: Amtsgericht Frankfurt am Main, HRB 76374
Geschäftsführer: Sebastian Schirmer

http://www.zyres.com/



Re: is delegator.storeAll() always committed?

Posted by Nicolas Malin <ma...@librenberry.net>.
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
>