Sanity checking makes for more sanity.

This commit is contained in:
Michael Bayne
2009-05-27 22:26:47 +00:00
parent c8e5a3b413
commit 601b9eaba1
@@ -244,7 +244,12 @@ public class PersistenceContext
public <T extends PersistentRecord> void registerMigration ( public <T extends PersistentRecord> void registerMigration (
Class<T> type, SchemaMigration migration) Class<T> type, SchemaMigration migration)
{ {
getRawMarshaller(type).registerMigration(migration); DepotMarshaller<T> marshaller = getRawMarshaller(type);
if (marshaller.isInitialized()) {
throw new IllegalStateException(
"Migrations must be registered before initializeRepositories() is called.");
}
marshaller.registerMigration(migration);
} }
/** /**