Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » CDO Transaction becomes not active the second time I open it
CDO Transaction becomes not active the second time I open it [message #1350821] Mon, 12 May 2014 20:57 Go to next message
Simone Di Cola is currently offline Simone Di ColaFriend
Messages: 60
Registered: February 2014
Member
I'm having trouble with committing a CDO transaction. Everything works ok the first time I try to commit, but the second time I receive this exception:

org.eclipse.net4j.util.lifecycle.LifecycleException: Not active: CDOTransactionImpl

Here is the code:

final TransactionalEditingDomain domain = editor.getDiagramBehavior().getEditingDomain();
		domain.getCommandStack().execute(new RecordingCommand(domain) {
			protected void doExecute() {
				try {
					
					// Open a transaction
					CDOTransaction cdoTransaction = cdoSession.openTransaction();
					cdoTransaction.addListener(new LifeListener());
					
					// Create a resource
					CDOResource cdoResource = cdoTransaction.getOrCreateResource(RESOURCE);
					if (existingComponent != null) {                                                                 // update the existing component
						cdoResource.getContents().remove(existingComponent);
					}
					cdoResource.getContents().add(component);
					cdoTransaction.commit();
					
					// Close the transaction
					cdoTransaction.close();
					
				} catch (ConcurrentAccessException e) {
					logger.error("Error during the CDO repository transaction.", e);
				} catch (CommitException e) {
					logger.error("Error commiting the CDO repository transaction.", e);
				}
			}
		});
Re: CDO Transaction becomes not active the second time I open it [message #1386121 is a reply to message #1350821] Fri, 13 June 2014 13:26 Go to previous message
Per Sterner is currently offline Per SternerFriend
Messages: 91
Registered: October 2011
Member
I think one of the items 'existingComponent' or 'component' is used after the 'transaction.close()'?

Perhaps you could use a global transaction for your editor?
Previous Topic:CDO and trasient feature
Next Topic:Extending models at runtime
Goto Forum:
  


Current Time: Sat Apr 27 05:00:16 GMT 2024

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

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

Back to the top