Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Offline clone doesn't reload offline branche(When restarting a clone in offline state, the wrong branche is loaded)
[CDO] Offline clone doesn't reload offline branche [message #1007501] Wed, 06 February 2013 08:39 Go to next message
Ricky de Klerck is currently offline Ricky de KlerckFriend
Messages: 295
Registered: January 2011
Senior Member
Hi,

When doing modifications in offline mode, a new offline branche is created. When closing and restarting the application the wrong branche is loaded. The changes that I've made in offline mode are gone.. Is this a bug or am I doing something wrong?

Regards,
Ricky de Klerck
Re: [CDO] Offline clone doesn't reload offline branche [message #1007556 is a reply to message #1007501] Wed, 06 February 2013 13:04 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 06.02.2013 09:40, schrieb Ricky de Klerck:
> Hi,
>
> When doing modifications in offline mode, a new offline branche is created. When closing and restarting the
> application the wrong branche is loaded. The changes that I've made in offline mode are gone.. Is this a bug or am I
> doing something wrong?
Neither, I'd say. You're probably just missing a minor but important step if you want to keep working in offline
branches across application restarts.

First, changes in a repo are never gone if auditing (or branching) is enabled. Especially branches can not be deleted.

Second, to be able to work with these offline branches after a client restart this client must store the ID of this
branch somewhere, e.g. in the file system. Here's some example code:

int branchID = loadBranchID();
CDOBranch branch = session.getBranchManager().getBranch(branchID);

CDOTransaction transaction = session.openTransaction(branch);
transaction.addListener(new IListener()
{
public void notifyEvent(IEvent event)
{
if (event instanceof CDOViewTargetChangedEvent)
{
CDOViewTargetChangedEvent e = (CDOViewTargetChangedEvent)event;
int branchID = e.getBranchPoint().getBranch().getID();
storeBranchID(branchID);
}
}
};

Does that help?

Cheers
/Eike

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


Re: [CDO] Offline clone doesn't reload offline branche [message #1007920 is a reply to message #1007556] Fri, 08 February 2013 08:18 Go to previous messageGo to next message
Ricky de Klerck is currently offline Ricky de KlerckFriend
Messages: 295
Registered: January 2011
Senior Member
Thank you Eike. I implemented your code and it works great!
Re: [CDO] Offline clone doesn't reload offline branche [message #1007992 is a reply to message #1007920] Fri, 08 February 2013 08:53 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 08.02.2013 09:18, schrieb Ricky de Klerck:
> Thank you Eike. I implemented your code and it works great!
Excellent ;-)

Cheers
/Eike

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


Previous Topic:[Teneo] EntityInterfaceNameStrategy not setting Enumerations as expected
Next Topic:Hibernate timeout on connection
Goto Forum:
  


Current Time: Thu Apr 25 09:20:59 GMT 2024

Powered by FUDForum. Page generated in 0.03095 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top