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 03:39 Go to next message
Ricky de Klerck is currently offline Ricky de Klerck
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 08:04 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5486
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 03:18 Go to previous messageGo to next message
Ricky de Klerck is currently offline Ricky de Klerck
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 03:53 Go to previous message
Eike Stepper is currently offline Eike Stepper
Messages: 5486
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 Jul 31 20:03:20 EDT 2014

Powered by FUDForum. Page generated in 0.01992 seconds