openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r596958 - /openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestDynamicClassRegistration.java
Date Wed, 21 Nov 2007 06:34:02 GMT
Author: pcl
Date: Tue Nov 20 22:34:00 2007
New Revision: 596958

URL: http://svn.apache.org/viewvc?rev=596958&view=rev
Log:
Example of how to do dynamic class registration in OpenJPA.

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestDynamicClassRegistration.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestDynamicClassRegistration.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestDynamicClassRegistration.java?rev=596958&r1=596957&r2=596958&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestDynamicClassRegistration.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/kernel/TestDynamicClassRegistration.java
Tue Nov 20 22:34:00 2007
@@ -42,12 +42,14 @@
         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);



Mime
View raw message