Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Updating CDO references in XMI Resource
[CDO] Updating CDO references in XMI Resource [message #1005499] Fri, 25 January 2013 12:10 Go to next message
Jack Lechner is currently offline Jack Lechner
Messages: 12
Registered: December 2012
Junior Member
Hello!

I am currently attempting to use an XMI Resource that has been stored as a CLOB in my db but I'm running across reference issues. The XMI Resource loads correctly when its referenced objects have CDOIDLong values but not when the objects have CDOIDTemp values.

I've found that I can update the XMI Resource by listening for a CDOTransactionFinished event, replacing the referenced temp CDOIDs with their corresponding Long values (in the XMI Resource), and then committing the updated XMI Resource to the db (as a CLOB). The problem with this is that it requires a second commit and seems like a very halfway answer to the issue at hand.

Is there an easier way to accomplish this or a better place in the code to update my XMI Resource? I'd really prefer to have everything committed at once if possible.

Thanks in advance!
Re: [CDO] Updating CDO references in XMI Resource [message #1005505 is a reply to message #1005499] Fri, 25 January 2013 12:56 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5486
Registered: July 2009
Senior Member
Hi Jack,

Unfortunately that's a known limitation with server-assigned IDs. A sensible solution would involve to "change the
changes" during the commit process in the server and transport the "outer changes" back to the committing client, which
is currently not supported by the protocol. A couple of times I thought that might be useful but it would require some
funding. If you're that much interested in this possibility you may want to contact me privately in order to discuss
details ;-)

As of CDO 4.1 there's kind of a workaround: You could configure your cdo-server.xml with <property
name="idGenerationLocation" value="CLIENT"/>. By default your local CDOSession would then assign UUIDs (String/byte[])
that don't change during the commit process on the server. But they consume more resources.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper




Am 25.01.2013 18:10, schrieb Jack Lechner:
> Hello!
>
> I am currently attempting to use an XMI Resource that has been stored as a CLOB in my db but I'm running across
> reference issues. The XMI Resource loads correctly when its referenced objects have CDOIDLong values but not when the
> objects have CDOIDTemp values.
>
> I've found that I can update the XMI Resource by listening for a CDOTransactionFinished event, replacing the
> referenced temp CDOIDs with their corresponding Long values (in the XMI Resource), and then committing the updated XMI
> Resource to the db (as a CLOB). The problem with this is that it requires a second commit and seems like a very
> halfway answer to the issue at hand.
>
> Is there an easier way to accomplish this or a better place in the code to update my XMI Resource? I'd really prefer
> to have everything committed at once if possible.
>
> Thanks in advance!
Re: [CDO] Updating CDO references in XMI Resource [message #1005512 is a reply to message #1005505] Fri, 25 January 2013 14:23 Go to previous messageGo to next message
Jack Lechner is currently offline Jack Lechner
Messages: 12
Registered: December 2012
Junior Member
That worked perfectly! Thank you very much!
Re: [CDO] Updating CDO references in XMI Resource [message #1005527 is a reply to message #1005512] Fri, 25 January 2013 23:27 Go to previous message
Eike Stepper is currently offline Eike Stepper
Messages: 5486
Registered: July 2009
Senior Member
Am 25.01.2013 20:23, schrieb Jack Lechner:
> That worked perfectly! Thank you very much!
I guess you tried the client-side assigned CDOIDs. If so you may be interested in this enhancement, too:

396379: [DB] Length of ID column should be configurable
https://bugs.eclipse.org/bugs/show_bug.cgi?id=396379

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Previous Topic:[CDO] NPE at org.eclipse.emf.ecore.util.EcoreUtil.getURI(EcoreUtil.java:2984)
Next Topic:Don't Get It - anyURI and ecore:reference
Goto Forum:
  


Current Time: Fri Aug 01 07:52:46 EDT 2014

Powered by FUDForum. Page generated in 0.01860 seconds