Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Do a rollback only for one resource
[CDO] Do a rollback only for one resource [message #1023891] Mon, 25 March 2013 07:49 Go to next message
Marc Gil is currently offline Marc Gil
Messages: 81
Registered: July 2009
Member
Hi,

I wonder if it's possible to do a rollback only for one CDOResource, not for all the CDOTransaction.

The reason to do that, is the following: you can be working on several resources of the same transaction at the same time. But you close an editor and when you're prompt about saving the resource, you click NO. Then, you can continue working on the other editors, and when you save any of them, the changes done in the closed editor, are commited too.

I want to do a rollback only of the resource of the closed editor. I tried to do a reload of this resource, but it doesn't work. The map of dirty objects of the transaction, always contains the modified elements of this resource.

Is it possible to do that?

Thanks!
Marc Gil
Re: [CDO] Do a rollback only for one resource [message #1023915 is a reply to message #1023891] Mon, 25 March 2013 09:03 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 25945
Registered: July 2009
Senior Member
I don't think so. If such changes are completely unrelated, you could do
them with separate transactions and then you'd have what you wanted.

On 25/03/2013 7:49 AM, Marc Gil wrote:
> Hi,
>
> I wonder if it's possible to do a rollback only for one CDOResource,
> not for all the CDOTransaction.
>
> The reason to do that, is the following: you can be working on several
> resources of the same transaction at the same time. But you close an
> editor and when you're prompt about saving the resource, you click NO.
> Then, you can continue working on the other editors, and when you save
> any of them, the changes done in the closed editor, are commited too.
>
> I want to do a rollback only of the resource of the closed editor. I
> tried to do a reload of this resource, but it doesn't work. The map of
> dirty objects of the transaction, always contains the modified
> elements of this resource.
>
> Is it possible to do that?
>
> Thanks!
> Marc Gil
Re: [CDO] Do a rollback only for one resource [message #1031010 is a reply to message #1023891] Mon, 01 April 2013 00:03 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5486
Registered: July 2009
Senior Member
Hi Marc,

Sorry for the late reply, I've just returned from the EclipseCon in Boston.

I agree with Ed, the changes are either unrelated and then they should be done with separate transactions. Or they are
related, then they can't be rolled back separately anyway.

Most CDO operations always relate to an entire repository to ensure referential integrity. One of the few exceptions is
CDOTransaction.setCommittables(Set<? extends EObject>), where you can set a subset of the changed objects to be
committed. This subset is checked for consistency before commit.

A similar thing could be done for rollback, but you'd have to contribute a respective patch.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Am 25.03.2013 12:49, schrieb Marc Gil:
> Hi,
>
> I wonder if it's possible to do a rollback only for one CDOResource, not for all the CDOTransaction.
>
> The reason to do that, is the following: you can be working on several resources of the same transaction at the same
> time. But you close an editor and when you're prompt about saving the resource, you click NO. Then, you can continue
> working on the other editors, and when you save any of them, the changes done in the closed editor, are commited too.
>
> I want to do a rollback only of the resource of the closed editor. I tried to do a reload of this resource, but it
> doesn't work. The map of dirty objects of the transaction, always contains the modified elements of this resource.
>
> Is it possible to do that?
>
> Thanks!
> Marc Gil
Re: [CDO] Do a rollback only for one resource [message #1031193 is a reply to message #1031010] Mon, 01 April 2013 06:31 Go to previous message
Marc Gil is currently offline Marc Gil
Messages: 81
Registered: July 2009
Member
Hi Eike and Ed,

Thanks for your responses. I agree with you too. I finally decided to open a View for the Session, and for every change I do to any resource (rename, DND...), or when I open a resource with my editors, I'll create a separated transaction. That's enough for me Smile

Cheers!
Marc
Previous Topic:[CDO] Error initializing server for PostgreSQL DB in CDO M6
Next Topic:The constructor BasicInternalEList&lt;...&gt; is undefined
Goto Forum:
  


Current Time: Wed Jul 30 11:25:08 EDT 2014

Powered by FUDForum. Page generated in 0.01756 seconds