You can download the code for this example here:
OnyxDevTools/onyx-database-samples/model-updates/
... UpdateIdentifierDemo.java.
There are 2 parts to this example. The first part is to create an existing database containing the original structure of your model. The second is to modify specific parts of the model and observe how the database handles the update.
This particular change involves changing the data type for an identifier and removing the generator from the @Identifier annotation. That indicates you would no longer like to automatically generate unique identifiers.
When defining an entity, begin with the end in mind. You should define the auto generated identifier as a long in order to account for a larger record set. In this case, we choose to ignore that reason and declare the identifier as an integer to demonstrate how Onyx has a remedy for that mistake.
In order to observe how the database reacts to changes we need to create a script to load sample data before updating the model of the Account so that we may preserve the format of the stored Accounts.
Connect to a new database and seed the data.
Change the account to a Long and remove the identifier generator.
Create a script to reconnect to the database.
Retrieve the account using a long rather than int.
Our goal is to bring about change by enabling people to use simple and quality software in order to make sad engineers happy.
Copyright ©2017 Onyx Development Tools, LLC. All rights reserved.