DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Andy Jefferson
Reporter: Andy Jefferson
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus Store RDBMS

Schema Generation : ordering of input classes can result in problems generating schema due to some not initialized yet

Created: 30/May/13 08:51 PM   Updated: 01/Jun/13 09:48 AM   Resolved: 31/May/13 09:22 AM
Component/s: ORM, Schema
Affects Version/s: None
Fix Version/s: 3.2.3

 Description  « Hide
When we have a complicated model with various interrelated classes with cyclical relations we can get a situation where the order of input or of naming of classes results in an exception about table XXX is not yet initialized.

Likely the best way would be restructure the ClassAdder around the following
1. Create Table object
2. preInitialize
3. manageClass for any other classes using this table
4. initialize
5. initializeSchemaCallbacks
6. postInitialize

The problem is that currently we trigger initializeSchemaCallbacks (not currently under that name) during initialize and some related tables may not have been initialized by then.

Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 31/May/13 09:22 AM
SVN trunk changes the ClassAdder process slightly for table initialisation; each table will initialize its supertable where necessary, and all tables will register that they have been initialised with the RDBMSStoreManager. This overcomes a provided test where a supertable wasn't yet initialized when trying to run the callbacks for another table.

Note, it's likely that splitting runCallbacks off into a later step may still be needed, but for the time being this is not done; wait until someone provides a testcase that needs it