Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] - Migrating from 4.6 to 4.10 - All tables are not created
[CDO] - Migrating from 4.6 to 4.10 - All tables are not created [message #1835914] Wed, 16 December 2020 10:42 Go to next message
Philippe EUGENE is currently offline Philippe EUGENEFriend
Messages: 58
Registered: January 2011
Member
Hi,
I'm migrating from CDO 4.6 to 4.10.
I'm using an embedded CDO server whith H2.
When the CDO server start all tables are not created in the DB.

With the same code in 4.6 and 4.10.
CDO 4.6 : over 300 tables are created.
CDO 4.10 : only 30 tables are created.

In 4.6 : with initialPackages set
In 4.10 : same behavior with or without initialPackages set?

Thanks for reply,
--
Philippe

[Updated on: Wed, 16 December 2020 10:42]

Report message to a moderator

Re: [CDO] - Migrating from 4.6 to 4.10 - All tables are not created [message #1835922 is a reply to message #1835914] Wed, 16 December 2020 15:18 Go to previous messageGo to next message
Philippe EUGENE is currently offline Philippe EUGENEFriend
Messages: 58
Registered: January 2011
Member
In CDO 4.6, the tables are created at the startup in AbstractMappingStrategy#createMapping

Quote:

if (packageUnits != null && packageUnits.length != 0)
{
IDBSchemaTransaction schemaTransaction = store.getDatabase().openSchemaTransaction();

try
{
mapPackageUnits(packageUnits, connection, false);
schemaTransaction.commit();
}
finally
{
schemaTransaction.close();
}
}


The table are created on the schemaTransaction.commit();

In CDO 4.10, the method has been refactored this way :
Quote:

try
{
if (packageUnits != null && packageUnits.length != 0)
{
async = monitor.forkAsync();

mapPackageUnits(packageUnits, connection, false);
}
}

This call schemaTransaction.commit(); was deleted.

The tables are now created in : DBStoreAccessor#writeRevisions.
The creation of tables are based on a list of initial revisions.

In my case these revisions contains only few tables, and then only few tables are created in the schema.
When my application want retrieve data from an Eclass, the underlying table does not exist and an exception occured.

Re: [CDO] - Migrating from 4.6 to 4.10 - All tables are not created [message #1835923 is a reply to message #1835914] Wed, 16 December 2020 15:23 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
As of CDO 4.7 tables are created lazily by default. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=534254 .
This can be configured via org.eclipse.emf.cdo.server.db.mapping.IMappingStrategy.Props.EAGER_TABLE_CREATION or via the <property name="eagerTableCreation" value="true|false"/> element in the cdo-server.xml.


Re: [CDO] - Migrating from 4.6 to 4.10 - All tables are not created [message #1835929 is a reply to message #1835923] Wed, 16 December 2020 16:13 Go to previous messageGo to next message
Philippe EUGENE is currently offline Philippe EUGENEFriend
Messages: 58
Registered: January 2011
Member
Thanks Eike.
If i set the property eagerTableCreation to true. CDO create all table but only for one package unit.
Now , i'm not initialized initialPackage when i start the CDO server.
Then in CDO_PACKAGE_UNITS i have only 4 record :
- three record about CDO
- one record for my model.

Only table of this nsURI are created at startup.

I need all tables created at startup. But i can't initialize all the nsURI in initialPackage.

In the MappingStrategy, when the class mapping is done, all the Eclass are known.
I see the constructor of AbstractHorizontalClassMapping that used the EAGER_TABLE_CREATION property but i don't see why all tables for mapped classes are not created.

[Updated on: Wed, 16 December 2020 16:14]

Report message to a moderator

Re: [CDO] - Migrating from 4.6 to 4.10 - All tables are not created [message #1835963 is a reply to message #1835929] Thu, 17 December 2020 09:23 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
peugene Mising name wrote on Wed, 16 December 2020 17:13
I need all tables created at startup.


Then you need to wait for my fix to the setInitialPackages() fix, which I can only start after you've submitted the respective bugzilla...


Re: [CDO] - Migrating from 4.6 to 4.10 - All tables are not created [message #1836660 is a reply to message #1835963] Mon, 11 January 2021 13:26 Go to previous message
Ewoud Werkman is currently offline Ewoud WerkmanFriend
Messages: 28
Registered: January 2018
Junior Member
I ran into the same issue. I also need all the tables to create a schema diff if my model has changed and adapt the database accordingly.
I created a bugzilla here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=570250
Previous Topic:How to get reference and value from diff
Next Topic:load model by using EMF API
Goto Forum:
  


Current Time: Fri Mar 29 09:57:58 GMT 2024

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

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

Back to the top