Created
July 5, 2016 14:28
-
-
Save cosbor11/272417322c420cf1162a16f6c92693c8 to your computer and use it in GitHub Desktop.
Main executable class to seed data to showcase the model update examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) throws EntityException{ | |
// Create a database and its connection | |
PersistenceManagerFactory factory = new EmbeddedPersistenceManagerFactory(); //1 | |
factory.setCredentials("onyx", "SavingDataisFun!"); //2 | |
String pathToOnyxDB = System.getProperty("user.home") | |
+ File.separatorChar + ".onyxdb" | |
+ File.separatorChar + "sandbox" | |
+ File.separatorChar +"model-update-db.oxd"; | |
// Cleanup the database before we begin | |
deleteDatabase(pathToOnyxDB); | |
factory.setDatabaseLocation(pathToOnyxDB); //3 | |
factory.initialize(); | |
PersistenceManager manager = factory.getPersistenceManager(); //5 | |
// Add Some test data | |
seedData(manager); | |
// Close the database cleanly | |
factory.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment