From 601b9eaba132ef7cd3d5917b3fe05c8d9032dcbf Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Wed, 27 May 2009 22:26:47 +0000 Subject: [PATCH] Sanity checking makes for more sanity. --- src/java/com/samskivert/depot/PersistenceContext.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/java/com/samskivert/depot/PersistenceContext.java b/src/java/com/samskivert/depot/PersistenceContext.java index 8ec6fce..311e12a 100644 --- a/src/java/com/samskivert/depot/PersistenceContext.java +++ b/src/java/com/samskivert/depot/PersistenceContext.java @@ -244,7 +244,12 @@ public class PersistenceContext public void registerMigration ( Class type, SchemaMigration migration) { - getRawMarshaller(type).registerMigration(migration); + DepotMarshaller marshaller = getRawMarshaller(type); + if (marshaller.isInitialized()) { + throw new IllegalStateException( + "Migrations must be registered before initializeRepositories() is called."); + } + marshaller.registerMigration(migration); } /**