I've just recently started using OpenJPA and from a new user perspective I 
interpreted "openjpa.RuntimeUnenhancedClasses=supported" to mean first check if 
the code is running within an app server and let the app server enhance the 
classes *then* fallback and actually do a runtime enhancement. It turns 
out "supported" may be better described as "true" in that it only makes one 
enhancement attempt then fails. I can successfully use "supported" when running 
my small JPA project not in an app server but when I put it on an app server I 
need to create my emf in a slightly different manner:

if (isWebSphere()) {
 Map<String, String> configOverrides = new HashMap<String, String>();
 configOverrides.put("openjpa.RuntimeUnenhancedClasses", "unsupported");        
    
 entityManagerFactory = 
Persistence.createEntityManagerFactory(persistenceUnitName, configOverrides);
} else {
 entityManagerFactory = 
Persistence.createEntityManagerFactory(persistenceUnitName);
}

I wish "supported" tried harder before failing. I've glanced at OPENJPA-377 and 
OPENJPA-651. Maybe I'm approaching things incorrectly? 


Does enhancing my classes at build time in my Ant script give me the same 
outcome/performance as letting the app server enhance my classes?

Reply via email to