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
This commit is contained in:
Patrick Linskey 2007-11-21 06:34:00 +00:00
parent 4fb39b9590
commit 21ec161339
1 changed files with 5 additions and 3 deletions

View File

@ -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);