CDO交易未激活

时间:2014-05-12 20:53:28

标签: eclipse-emf cdo

我在提交CDO交易时遇到了麻烦。我第一次尝试提交时一切正常,但第二次我收到这个例外:

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

以下是代码:

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);
            }
        }
    });

1 个答案:

答案 0 :(得分:0)

我对EMF Transactions / TransactionalEditingDomains不太熟悉。如果您怀疑CDO中存在错误,请在Eclipse.org上提交bugzilla并提供详细的问题描述,包括完整的堆栈跟踪。