public class DatabaseAdminImpl extends Object implements DatabaseAdmin
DATA_FILENAME, DATABASE_NAME, DATABASE_VERSION, DROP_SCHEMA_FILENAME, SCHEMA_FILENAME, UPGRADE_FILENAME_FORMAT| Constructor and Description |
|---|
DatabaseAdminImpl(String puName,
PersistenceAdmin persistenceAdmin,
ResourceEnvironment resourceEnvironment,
OpenHelperCallbacks openHelperCallbacks)
Construct a DatabaseAdminImpl object
|
| Modifier and Type | Method and Description |
|---|---|
OpenHelperCallbacks |
getCustomOpenHelperCallbacks() |
void |
initializeDatabase(PersistenceConfig persistenceConfig,
DatabaseSupport databaseSupport)
Open database and handle create/upgrade events
|
void |
onCreate(com.j256.ormlite.support.ConnectionSource connectionSource)
Database create handler.
|
void |
onUpgrade(com.j256.ormlite.support.ConnectionSource connectionSource,
int oldVersion,
int newVersion)
Database upgrade handler.
|
public DatabaseAdminImpl(String puName, PersistenceAdmin persistenceAdmin, ResourceEnvironment resourceEnvironment, OpenHelperCallbacks openHelperCallbacks)
puName - The persistence unit namepersistenceAdmin - The persistence unit connectionSource and properties providerpublic OpenHelperCallbacks getCustomOpenHelperCallbacks()
getCustomOpenHelperCallbacks in interface DatabaseAdminpublic void onCreate(com.j256.ormlite.support.ConnectionSource connectionSource)
onCreate in interface DatabaseAdminconnectionSource - An open ConnectionSource to be employed for all database activities.public void onUpgrade(com.j256.ormlite.support.ConnectionSource connectionSource,
int oldVersion,
int newVersion)
The SQLite ALTER TABLE documentation can be found here. If you add new columns you can use ALTER TABLE to insert them into a live table. If you rename or remove columns you can use ALTER TABLE to rename the old table, then create the new table and then populate the new table with the contents of the old table.
onUpgrade in interface DatabaseAdminconnectionSource - An open ConnectionSource to be employed for all database activities.oldVersion - The old database version.newVersion - The new database version.public void initializeDatabase(PersistenceConfig persistenceConfig, DatabaseSupport databaseSupport)
persistenceConfig - PersistenceUnitAdmin Unit ConfigurationdatabaseSupport - Database Support for specific database typeThis documentation is licensed by Andrew Bowley under the GPLv3 License.