Update comments to note Hibernate dependency

This commit is contained in:
Tim Donohue
2016-04-04 16:38:18 -05:00
parent 63c28a0b0e
commit 5f094ebb5f

View File

@@ -22,16 +22,21 @@ import org.slf4j.LoggerFactory;
/** /**
* This is a FlywayCallback class which automatically updates the * This is a FlywayCallback class which automatically updates the
* Metadata Schema Registry and Bitstream Formats Registries BEFORE * Metadata Schema Registry and Bitstream Formats Registries AFTER
* any Database migration occurs. * all Database migrations occur.
* <P> * <P>
* The reason this runs BEFORE a migration is to ensure that any new * The reason this runs AFTER all migrations is that the RegistryLoader
* metadata fields are FIRST added to our registries, so that the * and MetadataImporter now depend on Hibernate and Hibernate cannot be
* migrations can make use of those new metadata fields, etc. * initialized until the Database is fully migrated.
* <P> * <P>
* However, there is one exception. If this is a "fresh install" of DSpace, * If a migration needs to use on one or more registry values, there are
* we'll need to wait until the necessary database tables are created. In * two options:
* that scenario we will load registries AFTER the initial migration. * <UL>
* <LI>Create/insert those registry values in the migration itself (via SQL or similar).</LI>
* <LI>Alternatively, first check for the existence of the MetadataSchemaRegistry (or similar)
* before running the migration logic. If the table or fields do not yet exist, you might be
* able to skip the migration logic entirely. See "DatabaseUtils.tableExists()" and similar methods.</LI>
* </UL>
* *
* @author Tim Donohue * @author Tim Donohue
*/ */
@@ -111,6 +116,7 @@ public class DatabaseRegistryUpdater implements FlywayCallback
@Override @Override
public void afterMigrate(Connection connection) { public void afterMigrate(Connection connection) {
// Must run AFTER all migrations complete, since it is dependent on Hibernate
updateRegistries(); updateRegistries();
} }