cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marek Šabo <ms...@buk.cvut.cz>
Subject Re: Rolling back vs deleteobject
Date Mon, 15 Feb 2010 00:40:37 GMT
Thanks for clarification Andrey, glad that all is as I hoped it 'd be.

On 02/14/2010 10:00 PM, Andrey Razumovsky wrote:
> Hi,
>
> The example is correct. If something's gone wrong during the commit, you'll
> need to roll back so that bad data will not be present in next commit
> (assuming you're using WebApplicationContextFilter). In
> WebApplicationContextFilter there is one context per session.
> rollbackChangesLocally() is used to clean only nested context, without
> affecting parent context. If you're not creating nested contexts, it works
> same as rollbackChanges()
>
> 2010/2/12 Marek Šabo <msabo@buk.cvut.cz>
>
>   
>> Hi all,
>>
>> I would like to know your opininon on this (example adding user):
>>
>>  try {
>>            getObjectContext().commitChanges();
>>            return user;
>>        } catch (CayenneRuntimeException cre) {
>>            //getObjectContext().deleteObject(u);
>>            getObjectContext().rollbackChanges();
>>        }
>>
>> I was using deleteObject method but that didn't reccure so foreign key
>> objects were left just like that in context, rollback does the trick for me.
>> I'm not sure how exactly this rollback works when I'm using
>> getThreadObjectContext - will it be unique for every user session on
>> webserver?? I hope it's not shared amongst them. And what's the difference
>> from the "local" version of rollback?
>>
>> Thanks in advance,
>>
>> regards,
>>
>> Marek
>>
>>     
>
>
>   


-- 
Marek Šabo
Server Manager
Club SU CVUT Buben
Bubenečská Kolej (421)
XMPP: zeratul021@gmail.com


Mime
View raw message