Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] How to proceed when a genmodel changes?( How to proceed when a genmodel changes in order to keep current data of an entity)
[CDO] How to proceed when a genmodel changes? [message #1702463] Wed, 22 July 2015 13:34 Go to next message
Daniel Alonso is currently offline Daniel AlonsoFriend
Messages: 2
Registered: July 2015
Junior Member
Hi all!

I'm currently collaborating in a project that uses EMF and CDO. The point is we have an environment with an Entity called B (for example). Users have been recording elements in B but now, that entity has a new column.

The question is: if we update the model and launch our server, we get an exception, because the existing database doesn't have the new column... Is there any way in order to keep the data, update the schema and restore back all the data?

At this moment, the weight of our sql dump is about 15GB

Thank you so much in advance!!!
Re: [CDO] How to proceed when a genmodel changes? [message #1702505 is a reply to message #1702463] Wed, 22 July 2015 18:41 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 22.07.2015 um 16:59 schrieb Daniel Alonso:
> Hi all!
>
> I'm currently collaborating in a project that uses EMF and CDO. The point is we have an environment with an Entity
> called B (for example). Users have been recording elements in B but now, that entity has a new column.
>
> The question is: if we update the model and launch our server, we get an exception, because the existing database
> doesn't have the new column... Is there any way in order to keep the data, update the schema and restore back all the
> data?
There are several threads about "model evolution" in this forum that you should read first. You should find a number of
approaches there. The preferred one involves CDOServerExporter, external migration of the XML export and CDOServerImporter.

Cheers
/Eike

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


>
> At this moment, the weight of our sql dump is about 15GB
>
> Thank you so much in advance!!!


Re: [CDO] How to proceed when a genmodel changes? [message #1702516 is a reply to message #1702505] Wed, 22 July 2015 19:35 Go to previous messageGo to next message
Leonid Ripeynih is currently offline Leonid RipeynihFriend
Messages: 150
Registered: February 2012
Senior Member
I will also mention, that given that the case you're migrated, you scenario seems pretty simple.
1. Make sure you're using DBStore Annotations - to know table and columns names for sure (CDO will sometimes use object id's to name tables)
2. Write simple DDL to add a column of corresponding type to you database.
3. (Most important step!) is to update model stored in CDO. For this, you will need to perform a binary export of you model (see org.eclipse.emf.cdo.common.model.EMFUtil.getEPackageBytes(ePackage, zipped, packageRegistry), zipped should be true. Then you will need to upload the resulting BLOB in CDO_PACKAGE_UNIT table.

There is some more difficulties to that process, like making inserts to CDO_EXTERNAL_REFS when adding a new class - or crearing a table for many-to-many references but in general, most cases of backwards-compatible model evolution should be doable.
Re: [CDO] How to proceed when a genmodel changes? [message #1702567 is a reply to message #1702516] Thu, 23 July 2015 09:53 Go to previous messageGo to next message
Daniel Alonso is currently offline Daniel AlonsoFriend
Messages: 2
Registered: July 2015
Junior Member
Thanks to all!

At this moment, we have found that this issue is happening

https://bugs.eclipse.org/bugs/show_bug.cgi?id=343417

'cause still we are using cdo 4.1

According to your posts, still there is no automagically solution, right?
Re: [CDO] How to proceed when a genmodel changes? [message #1702575 is a reply to message #1702567] Thu, 23 July 2015 11:44 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Am 23.07.2015 um 11:53 schrieb Daniel Alonso:
> Thanks to all!
>
> At this moment, we have found that this issue is happening
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=343417
>
> 'cause still we are using cdo 4.1
>
> According to your posts, still there is no automagically solution, right?
You should definitely try to upgrade to newest/newer CDO versions. CDO 4.4 has just been released.

Cheers
/Eike

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


Previous Topic:CDO - What is the best persistence / IStore for large EMF datasets?
Next Topic:Setting genmodel's "Property Type" to "Editable" for all features
Goto Forum:
  


Current Time: Wed Apr 24 22:14:53 GMT 2024

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

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

Back to the top