From 21ec1613390ffe25d4ab8ffcc0ce3e5155940eef Mon Sep 17 00:00:00 2001 From: Patrick Linskey Date: Wed, 21 Nov 2007 06:34:00 +0000 Subject: [PATCH] Example of how to do dynamic class registration in OpenJPA. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@596958 13f79535-47bb-0310-9956-ffa450edef68 --- .../openjpa/kernel/TestDynamicClassRegistration.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestDynamicClassRegistration.java b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestDynamicClassRegistration.java index 0aa88bd02..91541a01c 100644 --- a/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestDynamicClassRegistration.java +++ b/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestDynamicClassRegistration.java @@ -42,12 +42,14 @@ public class TestDynamicClassRegistration emf = createNamedEMF("empty-pu"); } - public void testEnhancedDynamicClassRegistration() { + public void testEnhancedDynamicClassRegistration() + throws ClassNotFoundException { assertTrue( PersistenceCapable.class.isAssignableFrom(SimpleEntity.class)); - // trigger class initialization - new SimpleEntity(); + // trigger class initialization. We could just do 'new SimpleEntity()'. + Class.forName(SimpleEntity.class.getName(), true, + getClass().getClassLoader()); ClassMetaData meta = JPAFacadeHelper.getMetaData(emf, SimpleEntity.class);