[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: [CDO] CDOSavePoint and rollback question

hi Kai,

Kai Schlamp wrote:
Hello.

I have a question about using CDOSavePoint and rollback.
Excellent!!! Nobody asked questions about CDO this week !!! I was worried!! :-)

Let's assume the following scenario:
We have an EMF/CDO model that exists of an "ElementStore" that contains an "Element1" and an "Element2" (and those elements have some attributes).
Also let's assume we have two clients that work on this CDO model.
Client 1 now write locks Element1, sets a save point and edits Element1.
CLient1:
element1.cdoWriteLock().lock();
transaction1.setSavepoint();
element1.setName("sss");

In the meantime client 2 edits Element2.

Client2: element2.setname("sss2");

As passive updates are enabled
on client1, Element2 on client 1 is automatically updated with those changes.
If client1 received notification this mean you committed trans2... right?

so I will change client2 for the following:
Client2:
element2.setName("sss2");
transaction2.commit();

Now when client 1 rolls back to the save point (without transmitting anything before), all changes in Element1 (made by client 1) and Element2 (by client 2) are undone.
False, setSavePoint only apply the changes made locally. in this case only element.setName("sss") will be rolled back.

Is that right? If yes, is there a way to only roll back those changes that were done by client 1 itself (in this case only undo Element1 changes).
If this is what you observed it is a problem... it should not be like that. Did you experienced such things ?

When you said you had two clients.... I assumed you had 2 transactions... is it the case ?

Regards, Kai

Simon