Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Duplicate ID problem – Can a CDO model have multiple non-containment references to an external
[CDO] Duplicate ID problem – Can a CDO model have multiple non-containment references to an external [message #423922] Thu, 09 October 2008 22:14 Go to next message
Stephen McCants is currently offline Stephen McCantsFriend
Messages: 92
Registered: July 2009
Member
Hello,

Bryan Hunt and I just moved to a version of CDO from Head about two days ago and that resolved a
great many of our problems, including the two previously posted SQLExceptions. (Thank you, Eike,
for the recommendation.)

Our model is a tree structure and the leaf nodes have a non-containment reference to objects in
another CDO model. This is working well under the new code, except when I try to have two leaf
nodes point to the same object in the other CDO model. In that case, I get a “Duplicate ID” error
message (exception included below). I looked at the CDO source code, but didn't see any obvious way
around this limitation. Is there a way to allow a CDO model to support duplicate non-containment
references to another CDO model? If not, should there be?

Here is the exception:

java.lang.IllegalStateException: Duplicate ID: CDOResource@OID10
at org.eclipse.emf.internal.cdo.CDOViewImpl.registerObject(CDOV iewImpl.java:738)
at org.eclipse.emf.internal.cdo.CDOViewImpl.registerProxyResour ce(CDOViewImpl.java:717)
at
org.eclipse.emf.cdo.eresource.impl.CDOResourceFactoryImpl.cr eateResource(CDOResourceFactoryImpl.java:70)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createRe source(ResourceSetImpl.java:425)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandCr eateResource(ResourceSetImpl.java:239)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou rce(ResourceSetImpl.java:391)
at org.eclipse.emf.internal.cdo.CDOViewImpl.getResource(CDOView Impl.java:340)
at org.eclipse.emf.internal.cdo.CDOViewImpl.getResource(CDOView Impl.java:330)

Thanks in advance for your help!

Sincerely,
Stephen McCants
Re: [CDO] Duplicate ID problem – Can a CDO model have multiple non-containment references to an exte [message #423925 is a reply to message #423922] Fri, 10 October 2008 01:50 Go to previous messageGo to next message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
Hi Stephen,

I think your problem is related to the following bugs

248915: Resources fetched using CDOViewImpl.getResource(CDOID) not added to
ResourceSet
https://bugs.eclipse.org/bugs/show_bug.cgi?id=248915

I know in this case we do not add the resource in the resourceset.

but...
If the object was loaded in CDOView previously without being added to the
resourceset... and we try to load it from the resourceset afterwards.. we
will have the error you just had.

We are currently working to fix that problem.
Don't worry, CDO support non-containment references to another CDO-model.
The problem is how objects gets loaded in memory.

If you load the resource at the beginning (before loading others objects...
it should work). But I know it is not a solution.

Simon

"Stephen McCants" <stephenmccants@yahoo.com> wrote in message
news:gclvog$rir$1@build.eclipse.org...
> Hello,
>
> Bryan Hunt and I just moved to a version of CDO from Head about two days
> ago and that resolved a great many of our problems, including the two
> previously posted SQLExceptions. (Thank you, Eike, for the
> recommendation.)
>
> Our model is a tree structure and the leaf nodes have a non-containment
> reference to objects in another CDO model. This is working well under the
> new code, except when I try to have two leaf nodes point to the same
> object in the other CDO model. In that case, I get a “Duplicate ID” error
> message (exception included below). I looked at the CDO source code, but
> didn't see any obvious way around this limitation. Is there a way to
> allow a CDO model to support duplicate non-containment references to
> another CDO model? If not, should there be?
>
> Here is the exception:
>
> java.lang.IllegalStateException: Duplicate ID: CDOResource@OID10
> at
> org.eclipse.emf.internal.cdo.CDOViewImpl.registerObject(CDOV iewImpl.java:738)
> at
> org.eclipse.emf.internal.cdo.CDOViewImpl.registerProxyResour ce(CDOViewImpl.java:717)
> at
> org.eclipse.emf.cdo.eresource.impl.CDOResourceFactoryImpl.cr eateResource(CDOResourceFactoryImpl.java:70)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.createRe source(ResourceSetImpl.java:425)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandCr eateResource(ResourceSetImpl.java:239)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou rce(ResourceSetImpl.java:391)
> at
> org.eclipse.emf.internal.cdo.CDOViewImpl.getResource(CDOView Impl.java:340)
> at
> org.eclipse.emf.internal.cdo.CDOViewImpl.getResource(CDOView Impl.java:330)
>
> Thanks in advance for your help!
>
> Sincerely,
> Stephen McCants
Re: [CDO] Duplicate ID problem Can a CDO model have multiple non-containment references to an exter [message #423926 is a reply to message #423922] Fri, 10 October 2008 02:11 Go to previous message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
I`ve created a testcase and the fix that we`ve created for the problem
mention in th bugs 248915 fixed your problem. So it was really the same
things.

I added your testcase as well I will attach it to the bug in a few minutes
:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=248915

My patch will probably not go in since it is incomplete (other stuff is
missing) few things could change based on our discussion....
Meanwhile you can use my patch!! :-)

Simon

"Stephen McCants" <stephenmccants@yahoo.com> a
Previous Topic:[CDO] SQLException when loading cross CDO models
Next Topic:One-to-one references in Teneo 1.0.1
Goto Forum:
  


Current Time: Wed Apr 24 14:46:21 GMT 2024

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

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

Back to the top