You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Winster Jose <wi...@chathurangam.net> on 2013/02/22 13:40:01 UTC

How to handle transaction?

Hi,

I want to store entities into database using
"delegator.create(genericValue)". I want to wrap this operation in a
transaction so that if any of the entity insert operation fails, rollback
all previous insert operations. How can I do that in OFBiz?

Thanks in advance
Winster T Jose
Director - Technology and Architecture
Chathurangam Creative Solutions Private Ltd.
Cell: +91-98469 31020
Mail: winster@chathurangam.net

Re: How to handle transaction?

Posted by Winster Jose <wi...@chathurangam.net>.
Thank you.
On 22 Feb 2013 21:51, "Deepak Agarwal" <da...@gmail.com> wrote:

> Hello Winster,
>
> You need to call the service as :
>
> dispatcher.runSync("MyService", map);
>
> This way a new transaction is automatically created if there is no current
> transaction in place.  If there was a transaction (in case of service
> chain, one service calling to another service) a new transaction is not
> created (unless in service definition you have mentioned to create a new
> transaction always).
>
> On Fri, Feb 22, 2013 at 9:41 PM, Adrian Crum <
> adrian.crum@sandglass-software.com> wrote:
>
> > How did you invoke Groovy?
> >
> > -Adrian
> >
> >
> > On 2/22/2013 1:48 PM, Winster Jose wrote:
> >
> >> Thanks Adrian. Currently I am invoking the method from groovy directly.
> >> So,
> >> I need to change the way I did, right?
> >>
> >> On Fri, Feb 22, 2013 at 7:13 PM, Adrian Crum <
> >> adrian.crum@sandglass-**software.com <
> adrian.crum@sandglass-software.com>>
> >> wrote:
> >>
> >>  If the operation is within a service, you don't need to worry about
> >>> handling transactions - the service engine does that for you.
> >>>
> >>> -Adrian
> >>>
> >>>
> >>> On 2/22/2013 12:40 PM, Winster Jose wrote:
> >>>
> >>>  Hi,
> >>>>
> >>>> I want to store entities into database using
> >>>> "delegator.create(****genericValue)". I want to wrap this operation in
> >>>> a
> >>>> transaction so that if any of the entity insert operation fails,
> >>>> rollback
> >>>> all previous insert operations. How can I do that in OFBiz?
> >>>>
> >>>> Thanks in advance
> >>>> Winster T Jose
> >>>> Director - Technology and Architecture
> >>>> Chathurangam Creative Solutions Private Ltd.
> >>>> Cell: +91-98469 31020
> >>>> Mail: winster@chathurangam.net
> >>>>
> >>>>
> >>>>
> >>
> >
>
>
> --
> Thanks,
> Deepak Agarwal,
>
> Mobile: +91 9501190044
>

Re: How to handle transaction?

Posted by Deepak Agarwal <da...@gmail.com>.
Hello Winster,

You need to call the service as :

dispatcher.runSync("MyService", map);

This way a new transaction is automatically created if there is no current
transaction in place.  If there was a transaction (in case of service
chain, one service calling to another service) a new transaction is not
created (unless in service definition you have mentioned to create a new
transaction always).

On Fri, Feb 22, 2013 at 9:41 PM, Adrian Crum <
adrian.crum@sandglass-software.com> wrote:

> How did you invoke Groovy?
>
> -Adrian
>
>
> On 2/22/2013 1:48 PM, Winster Jose wrote:
>
>> Thanks Adrian. Currently I am invoking the method from groovy directly.
>> So,
>> I need to change the way I did, right?
>>
>> On Fri, Feb 22, 2013 at 7:13 PM, Adrian Crum <
>> adrian.crum@sandglass-**software.com <ad...@sandglass-software.com>>
>> wrote:
>>
>>  If the operation is within a service, you don't need to worry about
>>> handling transactions - the service engine does that for you.
>>>
>>> -Adrian
>>>
>>>
>>> On 2/22/2013 12:40 PM, Winster Jose wrote:
>>>
>>>  Hi,
>>>>
>>>> I want to store entities into database using
>>>> "delegator.create(****genericValue)". I want to wrap this operation in
>>>> a
>>>> transaction so that if any of the entity insert operation fails,
>>>> rollback
>>>> all previous insert operations. How can I do that in OFBiz?
>>>>
>>>> Thanks in advance
>>>> Winster T Jose
>>>> Director - Technology and Architecture
>>>> Chathurangam Creative Solutions Private Ltd.
>>>> Cell: +91-98469 31020
>>>> Mail: winster@chathurangam.net
>>>>
>>>>
>>>>
>>
>


-- 
Thanks,
Deepak Agarwal,

Mobile: +91 9501190044

Re: How to handle transaction?

Posted by Adrian Crum <ad...@sandglass-software.com>.
How did you invoke Groovy?

-Adrian

On 2/22/2013 1:48 PM, Winster Jose wrote:
> Thanks Adrian. Currently I am invoking the method from groovy directly. So,
> I need to change the way I did, right?
>
> On Fri, Feb 22, 2013 at 7:13 PM, Adrian Crum <
> adrian.crum@sandglass-software.com> wrote:
>
>> If the operation is within a service, you don't need to worry about
>> handling transactions - the service engine does that for you.
>>
>> -Adrian
>>
>>
>> On 2/22/2013 12:40 PM, Winster Jose wrote:
>>
>>> Hi,
>>>
>>> I want to store entities into database using
>>> "delegator.create(**genericValue)". I want to wrap this operation in a
>>> transaction so that if any of the entity insert operation fails, rollback
>>> all previous insert operations. How can I do that in OFBiz?
>>>
>>> Thanks in advance
>>> Winster T Jose
>>> Director - Technology and Architecture
>>> Chathurangam Creative Solutions Private Ltd.
>>> Cell: +91-98469 31020
>>> Mail: winster@chathurangam.net
>>>
>>>
>


Re: How to handle transaction?

Posted by Winster Jose <wi...@chathurangam.net>.
Thanks Adrian. Currently I am invoking the method from groovy directly. So,
I need to change the way I did, right?

On Fri, Feb 22, 2013 at 7:13 PM, Adrian Crum <
adrian.crum@sandglass-software.com> wrote:

> If the operation is within a service, you don't need to worry about
> handling transactions - the service engine does that for you.
>
> -Adrian
>
>
> On 2/22/2013 12:40 PM, Winster Jose wrote:
>
>> Hi,
>>
>> I want to store entities into database using
>> "delegator.create(**genericValue)". I want to wrap this operation in a
>> transaction so that if any of the entity insert operation fails, rollback
>> all previous insert operations. How can I do that in OFBiz?
>>
>> Thanks in advance
>> Winster T Jose
>> Director - Technology and Architecture
>> Chathurangam Creative Solutions Private Ltd.
>> Cell: +91-98469 31020
>> Mail: winster@chathurangam.net
>>
>>
>


-- 
Winster T Jose
Director - Technology and Architecture
Chathurangam Creative Solutions Private Ltd.
Cell: +91-98469 31020
Mail: winster@chathurangam.net

Re: How to handle transaction?

Posted by Adrian Crum <ad...@sandglass-software.com>.
If the operation is within a service, you don't need to worry about 
handling transactions - the service engine does that for you.

-Adrian

On 2/22/2013 12:40 PM, Winster Jose wrote:
> Hi,
>
> I want to store entities into database using
> "delegator.create(genericValue)". I want to wrap this operation in a
> transaction so that if any of the entity insert operation fails, rollback
> all previous insert operations. How can I do that in OFBiz?
>
> Thanks in advance
> Winster T Jose
> Director - Technology and Architecture
> Chathurangam Creative Solutions Private Ltd.
> Cell: +91-98469 31020
> Mail: winster@chathurangam.net
>