Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » CDO Adding a new resource
CDO Adding a new resource [message #422909] Thu, 18 September 2008 14:21 Go to next message
Paul Richardson is currently offline Paul RichardsonFriend
Messages: 33
Registered: July 2009
Member
Hi guys,

Running a CDO server (version 2.0.0 stable build: ,200809110653) I can
now get our client app to connect and disconnect from the server. I can
also add containered objects without a hitch. However, I keep getting
an error when trying to add a new object that is not containered and
thus needs its own resource.

This is the code I use for the commit operation, where eObject is the
newly created object passed into the method:

if (eObject != null && eObject.eContainingFeature() == null &&
eObject.eResource() == null)
{
/* Object is not a contained feature */
//Create resource
URI newUri = URI.createURI("cdo:/" + getRepositoryName() + "/TEST");
Resource resource = transaction.getOrCreateResource(newUri.path());

if (resource.getContents().isEmpty())
resource.getContents().add(eObject);

for (Resource res : transaction.getResourceSet().getResources())
System.out.println("Resource in resourceSet: " + res + " URI: "
+ res.getURI());

}

if (transaction.isDirty())
transaction.commit();

I am able to confirm that the resource is successfully added to the
resource set:
Resource in resourceSet: CDOResource@OID7 URI:
cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/ISSE/CDO3
Resource in resourceSet: CDOResource@oid1 URI:
cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/ISSE/TEST

yet I get the following exception:

class org.eclipse.net4j.util.ImplementationError
Message:Missing ID mapping for oid1

org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl .remapID(CDORevisionImpl.java:800)

org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl .adjustReferences(CDORevisionImpl.java:440)
org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:517)
org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:309)
org.eclipse.emf.internal.cdo.CDOTransactionImpl$CDOCommitCon textImpl.postCommit(CDOTransactionImpl.java:986)
org.eclipse.emf.internal.cdo.CDOTransactionImpl$CDOCommitCon textImpl.postCommit(CDOTransactionImpl.java:919)
org.eclipse.emf.internal.cdo.CDOSingleTransactionStrategy.co mmit(CDOSingleTransactionStrategy.java:70)
org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:285)
isse.project.impl.RepositoryConnectionImpl.commit(Repository ConnectionImpl.java:291)
isse.model.ModelActionProvider.persistElement(ModelActionPro vider.java:146)
isse.netbeans.framework.IDENode.bridge.IDENodeAdapter.notify Changed(IDENodeAdapter.java:82)

Can anyone give me a pointer please. Oddly enough this was working in
CDO 1.0 so maybe I am missing something vital that is the difference
between the versions.

Regards

PGR
Re: CDO Adding a new resource [message #422913 is a reply to message #422909] Thu, 18 September 2008 14:51 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi PGR,

Which IStore implementation are you using for your repository? IIRC.
only today I saw some tests failing in the HibernateStore with the same
exception (but didn't come to it yet)...

Cheers
/Eike


phantomjinx schrieb:
> Hi guys,
>
> Running a CDO server (version 2.0.0 stable build: ,200809110653) I can
> now get our client app to connect and disconnect from the server. I
> can also add containered objects without a hitch. However, I keep
> getting an error when trying to add a new object that is not
> containered and thus needs its own resource.
>
> This is the code I use for the commit operation, where eObject is the
> newly created object passed into the method:
>
> if (eObject != null && eObject.eContainingFeature() == null &&
> eObject.eResource() == null)
> {
> /* Object is not a contained feature */
> //Create resource
> URI newUri = URI.createURI("cdo:/" + getRepositoryName() +
> "/TEST");
> Resource resource = transaction.getOrCreateResource(newUri.path());
>
> if (resource.getContents().isEmpty())
> resource.getContents().add(eObject);
>
> for (Resource res : transaction.getResourceSet().getResources())
> System.out.println("Resource in resourceSet: " + res + " URI:
> " + res.getURI());
>
> }
>
> if (transaction.isDirty())
> transaction.commit();
>
> I am able to confirm that the resource is successfully added to the
> resource set:
> Resource in resourceSet: CDOResource@OID7 URI:
> cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/ISSE/CDO3
> Resource in resourceSet: CDOResource@oid1 URI:
> cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/ISSE/TEST
>
> yet I get the following exception:
>
> class org.eclipse.net4j.util.ImplementationError
> Message:Missing ID mapping for oid1
>
> org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl .remapID(CDORevisionImpl.java:800)
>
> org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl .adjustReferences(CDORevisionImpl.java:440)
>
> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:517)
>
> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>
> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>
> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:309)
>
> org.eclipse.emf.internal.cdo.CDOTransactionImpl$CDOCommitCon textImpl.postCommit(CDOTransactionImpl.java:986)
>
> org.eclipse.emf.internal.cdo.CDOTransactionImpl$CDOCommitCon textImpl.postCommit(CDOTransactionImpl.java:919)
> org.eclipse.emf.internal.cdo.CDOSingleTransactionStrategy.co mmit(CDOSingleTransactionStrategy.java:70)
>
> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:285)
>
> isse.project.impl.RepositoryConnectionImpl.commit(Repository ConnectionImpl.java:291)
>
> isse.model.ModelActionProvider.persistElement(ModelActionPro vider.java:146)
>
> isse.netbeans.framework.IDENode.bridge.IDENodeAdapter.notify Changed(IDENodeAdapter.java:82)
>
>
> Can anyone give me a pointer please. Oddly enough this was working in
> CDO 1.0 so maybe I am missing something vital that is the difference
> between the versions.
>
> Regards
>
> PGR


Re: CDO Adding a new resource [message #422920 is a reply to message #422913] Thu, 18 September 2008 19:18 Go to previous messageGo to next message
Paul Richardson is currently offline Paul RichardsonFriend
Messages: 33
Registered: July 2009
Member
Eike,

Sorry, not totally certain what you mean by IStore. However, my topology
is a CDO server running standalone in an osgi session with a derby
database backend.

Not using Hibernate.

Hope that helps. Any more info or debugging required then let me know.

Regards

PGR

Eike Stepper wrote:
> Hi PGR,
>
> Which IStore implementation are you using for your repository? IIRC.
> only today I saw some tests failing in the HibernateStore with the same
> exception (but didn't come to it yet)...
>
> Cheers
> /Eike
>
>
> phantomjinx schrieb:
>> Hi guys,
>>
>> Running a CDO server (version 2.0.0 stable build: ,200809110653) I can
>> now get our client app to connect and disconnect from the server. I
>> can also add containered objects without a hitch. However, I keep
>> getting an error when trying to add a new object that is not
>> containered and thus needs its own resource.
>>
>> This is the code I use for the commit operation, where eObject is the
>> newly created object passed into the method:
>>
>> if (eObject != null && eObject.eContainingFeature() == null &&
>> eObject.eResource() == null)
>> {
>> /* Object is not a contained feature */
>> //Create resource
>> URI newUri = URI.createURI("cdo:/" + getRepositoryName() +
>> "/TEST");
>> Resource resource = transaction.getOrCreateResource(newUri.path());
>>
>> if (resource.getContents().isEmpty())
>> resource.getContents().add(eObject);
>>
>> for (Resource res : transaction.getResourceSet().getResources())
>> System.out.println("Resource in resourceSet: " + res + " URI:
>> " + res.getURI());
>>
>> }
>>
>> if (transaction.isDirty())
>> transaction.commit();
>>
>> I am able to confirm that the resource is successfully added to the
>> resource set:
>> Resource in resourceSet: CDOResource@OID7 URI:
>> cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/ISSE/CDO3
>> Resource in resourceSet: CDOResource@oid1 URI:
>> cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/ISSE/TEST
>>
>> yet I get the following exception:
>>
>> class org.eclipse.net4j.util.ImplementationError
>> Message:Missing ID mapping for oid1
>>
>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl .remapID(CDORevisionImpl.java:800)
>>
>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl .adjustReferences(CDORevisionImpl.java:440)
>>
>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:517)
>>
>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>>
>> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>>
>> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:309)
>>
>> org.eclipse.emf.internal.cdo.CDOTransactionImpl$CDOCommitCon textImpl.postCommit(CDOTransactionImpl.java:986)
>>
>> org.eclipse.emf.internal.cdo.CDOTransactionImpl$CDOCommitCon textImpl.postCommit(CDOTransactionImpl.java:919)
>> org.eclipse.emf.internal.cdo.CDOSingleTransactionStrategy.co mmit(CDOSingleTransactionStrategy.java:70)
>>
>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:285)
>>
>> isse.project.impl.RepositoryConnectionImpl.commit(Repository ConnectionImpl.java:291)
>>
>> isse.model.ModelActionProvider.persistElement(ModelActionPro vider.java:146)
>>
>> isse.netbeans.framework.IDENode.bridge.IDENodeAdapter.notify Changed(IDENodeAdapter.java:82)
>>
>>
>> Can anyone give me a pointer please. Oddly enough this was working in
>> CDO 1.0 so maybe I am missing something vital that is the difference
>> between the versions.
>>
>> Regards
>>
>> PGR
Re: CDO Adding a new resource [message #422923 is a reply to message #422920] Thu, 18 September 2008 19:23 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
phantomjinx schrieb:
> Eike,
>
> Sorry, not totally certain what you mean by IStore. However, my
> topology is a CDO server running standalone in an osgi session with a
> derby database backend.
>
> Not using Hibernate.
>
> Hope that helps. Any more info or debugging required then let me know.
Yes, complete console dumps of client and server would be very helpful
to track down the problem.
Can you please attach them to a new Bugzilla?

Thx
/Eike

>
> Regards
>
> PGR
>
> Eike Stepper wrote:
>> Hi PGR,
>>
>> Which IStore implementation are you using for your repository? IIRC.
>> only today I saw some tests failing in the HibernateStore with the
>> same exception (but didn't come to it yet)...
>>
>> Cheers
>> /Eike
>>
>>
>> phantomjinx schrieb:
>>> Hi guys,
>>>
>>> Running a CDO server (version 2.0.0 stable build: ,200809110653) I
>>> can now get our client app to connect and disconnect from the
>>> server. I can also add containered objects without a hitch.
>>> However, I keep getting an error when trying to add a new object
>>> that is not containered and thus needs its own resource.
>>>
>>> This is the code I use for the commit operation, where eObject is
>>> the newly created object passed into the method:
>>>
>>> if (eObject != null && eObject.eContainingFeature() == null &&
>>> eObject.eResource() == null)
>>> {
>>> /* Object is not a contained feature */
>>> //Create resource
>>> URI newUri = URI.createURI("cdo:/" + getRepositoryName() +
>>> "/TEST");
>>> Resource resource =
>>> transaction.getOrCreateResource(newUri.path());
>>>
>>> if (resource.getContents().isEmpty())
>>> resource.getContents().add(eObject);
>>>
>>> for (Resource res : transaction.getResourceSet().getResources())
>>> System.out.println("Resource in resourceSet: " + res + "
>>> URI: " + res.getURI());
>>>
>>> }
>>>
>>> if (transaction.isDirty())
>>> transaction.commit();
>>>
>>> I am able to confirm that the resource is successfully added to the
>>> resource set:
>>> Resource in resourceSet: CDOResource@OID7 URI:
>>> cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/ISSE/CDO3
>>> Resource in resourceSet: CDOResource@oid1 URI:
>>> cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/ISSE/TEST
>>>
>>> yet I get the following exception:
>>>
>>> class org.eclipse.net4j.util.ImplementationError
>>> Message:Missing ID mapping for oid1
>>>
>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl .remapID(CDORevisionImpl.java:800)
>>>
>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl .adjustReferences(CDORevisionImpl.java:440)
>>>
>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:517)
>>>
>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>>>
>>> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>>>
>>> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:309)
>>>
>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl$CDOCommitCon textImpl.postCommit(CDOTransactionImpl.java:986)
>>>
>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl$CDOCommitCon textImpl.postCommit(CDOTransactionImpl.java:919)
>>> org.eclipse.emf.internal.cdo.CDOSingleTransactionStrategy.co mmit(CDOSingleTransactionStrategy.java:70)
>>>
>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:285)
>>>
>>> isse.project.impl.RepositoryConnectionImpl.commit(Repository ConnectionImpl.java:291)
>>>
>>> isse.model.ModelActionProvider.persistElement(ModelActionPro vider.java:146)
>>>
>>> isse.netbeans.framework.IDENode.bridge.IDENodeAdapter.notify Changed(IDENodeAdapter.java:82)
>>>
>>>
>>> Can anyone give me a pointer please. Oddly enough this was working
>>> in CDO 1.0 so maybe I am missing something vital that is the
>>> difference between the versions.
>>>
>>> Regards
>>>
>>> PGR


Re: CDO Adding a new resource [message #422925 is a reply to message #422923] Thu, 18 September 2008 22:34 Go to previous message
Paul Richardson is currently offline Paul RichardsonFriend
Messages: 33
Registered: July 2009
Member
Bug 247910 submitted.

PGR

Eike Stepper wrote:
> phantomjinx schrieb:
>> Eike,
>>
>> Sorry, not totally certain what you mean by IStore. However, my
>> topology is a CDO server running standalone in an osgi session with a
>> derby database backend.
>>
>> Not using Hibernate.
>>
>> Hope that helps. Any more info or debugging required then let me know.
> Yes, complete console dumps of client and server would be very helpful
> to track down the problem.
> Can you please attach them to a new Bugzilla?
>
> Thx
> /Eike
>
>>
>> Regards
>>
>> PGR
>>
>> Eike Stepper wrote:
>>> Hi PGR,
>>>
>>> Which IStore implementation are you using for your repository? IIRC.
>>> only today I saw some tests failing in the HibernateStore with the
>>> same exception (but didn't come to it yet)...
>>>
>>> Cheers
>>> /Eike
>>>
>>>
>>> phantomjinx schrieb:
>>>> Hi guys,
>>>>
>>>> Running a CDO server (version 2.0.0 stable build: ,200809110653) I
>>>> can now get our client app to connect and disconnect from the
>>>> server. I can also add containered objects without a hitch.
>>>> However, I keep getting an error when trying to add a new object
>>>> that is not containered and thus needs its own resource.
>>>>
>>>> This is the code I use for the commit operation, where eObject is
>>>> the newly created object passed into the method:
>>>>
>>>> if (eObject != null && eObject.eContainingFeature() == null &&
>>>> eObject.eResource() == null)
>>>> {
>>>> /* Object is not a contained feature */
>>>> //Create resource
>>>> URI newUri = URI.createURI("cdo:/" + getRepositoryName() +
>>>> "/TEST");
>>>> Resource resource =
>>>> transaction.getOrCreateResource(newUri.path());
>>>>
>>>> if (resource.getContents().isEmpty())
>>>> resource.getContents().add(eObject);
>>>>
>>>> for (Resource res : transaction.getResourceSet().getResources())
>>>> System.out.println("Resource in resourceSet: " + res + "
>>>> URI: " + res.getURI());
>>>>
>>>> }
>>>>
>>>> if (transaction.isDirty())
>>>> transaction.commit();
>>>>
>>>> I am able to confirm that the resource is successfully added to the
>>>> resource set:
>>>> Resource in resourceSet: CDOResource@OID7 URI:
>>>> cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/ISSE/CDO3
>>>> Resource in resourceSet: CDOResource@oid1 URI:
>>>> cdo://1ff5d226-b1f0-40fb-aba2-0c31b38c764f/ISSE/TEST
>>>>
>>>> yet I get the following exception:
>>>>
>>>> class org.eclipse.net4j.util.ImplementationError
>>>> Message:Missing ID mapping for oid1
>>>>
>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl .remapID(CDORevisionImpl.java:800)
>>>>
>>>> org.eclipse.emf.cdo.internal.common.revision.CDORevisionImpl .adjustReferences(CDORevisionImpl.java:440)
>>>>
>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:517)
>>>>
>>>> org.eclipse.emf.internal.cdo.CDOStateMachine$CommitTransitio n.execute(CDOStateMachine.java:1)
>>>>
>>>> org.eclipse.net4j.util.fsm.FiniteStateMachine.process(Finite StateMachine.java:161)
>>>>
>>>> org.eclipse.emf.internal.cdo.CDOStateMachine.commit(CDOState Machine.java:309)
>>>>
>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl$CDOCommitCon textImpl.postCommit(CDOTransactionImpl.java:986)
>>>>
>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl$CDOCommitCon textImpl.postCommit(CDOTransactionImpl.java:919)
>>>> org.eclipse.emf.internal.cdo.CDOSingleTransactionStrategy.co mmit(CDOSingleTransactionStrategy.java:70)
>>>>
>>>> org.eclipse.emf.internal.cdo.CDOTransactionImpl.commit(CDOTr ansactionImpl.java:285)
>>>>
>>>> isse.project.impl.RepositoryConnectionImpl.commit(Repository ConnectionImpl.java:291)
>>>>
>>>> isse.model.ModelActionProvider.persistElement(ModelActionPro vider.java:146)
>>>>
>>>> isse.netbeans.framework.IDENode.bridge.IDENodeAdapter.notify Changed(IDENodeAdapter.java:82)
>>>>
>>>>
>>>> Can anyone give me a pointer please. Oddly enough this was working
>>>> in CDO 1.0 so maybe I am missing something vital that is the
>>>> difference between the versions.
>>>>
>>>> Regards
>>>>
>>>> PGR
Previous Topic:Creating EMF model from XML schema - special characters - com.montages.xml.zip (0/1)
Next Topic:[CDO] XMI models referencing elements stored in CDO
Goto Forum:
  


Current Time: Fri Apr 19 14:02:13 GMT 2024

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

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

Back to the top