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 <msab..uk.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
>
-- Andrey
This archive was generated by hypermail 2.0.0 : Sun Feb 14 2010 - 16:01:30 EST