Thanks Andrus for your quick reply. I will try that now.
- Bhagwanji
-----Original Message-----
From: Andrus Adamchik [mailto:andru..bjectstyle.org]
Sent: Monday, February 28, 2005 10:53 AM
To: cayenne-use..bjectstyle.org
Subject: Re: Stored Procedure Query and Transactions
Forget Spring ... It'll work of course, but I am overcomplicating the
issue and really need more coffee. You can do a one-off transaction, while
keeping clean implicit transaction handling everywhere else. And can't be
any simpler than that:
List queries = new ArrayList();
queries.add(query1);
queries.add(query2);
// this will run both queries in the same transaciton
// doing a rollback on failure
dataContext.performQueries(queries, new QueryResult());
Andrus
>> Hi,
>>
>> I have some existing oracle stored procedures with business logic in
>> our DB. I have created cayenne model for those procedures. I am
>> calling storedProceA and then storedProcB. I have a requirement where
>> I need to rollback all the work done by storeProcA if storeProcB
>> fails. Is it possible to rollback stored procedure call using cayenne
>> ? Please let me know if there is a way to tie both the storeProc calls
>> in a single transaction and either commit or rollback in a single
>> transaction.
>>
>> - Bhagwanji
>
>
> Hi,
>
> You will need to run Cayenne with "external transactions" flag checked,
> and provide some external transaction mechanism. The easiest (but not
> the only) way to implement such externa transactions is to use Spring
> framework (www.springframework.org). Cayenne-Spring integration code and
> examples can be downloaded from here -
> http://objectstyle.org/cayenne/lists/cayenne-user/2004/12/0153.html (it
> is submitted to Spring already and is scheduled to become a part of
> their official distro in 1.3 release).
>
> And of course make sure that your procedures do not commit internally...
>
> Andrus
This archive was generated by hypermail 2.0.0 : Mon Feb 28 2005 - 12:01:08 EST