Friday July 27, 2007OpenJPA no longer requires bytecode processing
Historically, OpenJPA required that you either run a post-compilation tool or run your application with a javaagent. The latest build of OpenJPA removes this restriction by providing various levels of support for unenhanced classes.
This feature is primarily targeted at development-time usage, to reduce the number of steps involved in running tests. As ever, when deployed in a Java EE 5 environment, OpenJPA will automatically run its enhancer as classes are loaded. This, combined with the existing ant-based or command-line-invoked enhancer, means that you can still get optimal memory and performance characteristics when you deploy your application to production.
There are a few limitations. The performance and memory impact of this new behavior will vary depending on the environment that you use OpenJPA in and whether you use property or field access for your classes. In the best case, there will be a slight performance impact due to a bit of runtime reflection. In the worst case, OpenJPA will need to run a state comparison algorithm at flush / commit time to locate dirty data. This means that OpenJPA will hold hard references to all applicable instances loaded in a given transaction, and will also make a copy of all fields as the instances are loaded, for use in later dirty-detection comparisons.
Additionally, if using field access in a Java 5 environment without specifying the OpenJPA javaagent, the default lazy loading configuration will be ignored for one-to-one and many-to-one relationship types.
As with all OpenJPA features, this will make it into the Kodo product once Kodo picks up a new OpenJPA build. Intrepid users out there might be able to use the feature now by replacing the openjpa.jar in their current Kodo distribution; bear in mind that Kodo might depend on interfaces or behavior that has changed in newer versions of OpenJPA, though.
UPDATE: We are actively working on getting the JPA TCK to pass in various unenhanced configurations. I believe that according to the TCK terms, I'm not allowed to disclose anything other than "it passes 100%" or "it doesn't pass 100%", so I'll leave it at that. But I expect that the feature should work for pretty much all use cases. If you run into a problem, please make sure you're using a recent build (svn revision > 560016), and let us know at dev@openjpa.apache.org.
UPDATE 2: It looks like the OpenJPA nightly build didn't upload last night, so the one on the download page is still the old version. Sorry about the false alarm.
UPDATE 3: The nightly build on the OpenJPA download page is up-to-date now.
Posted by pcl ( Jul 27 2007, 01:01:12 PM PDT ) Permalink Comments [2]You are viewing a mobilized version of this site...
View original page here
Posted by James Strachan on July 30, 2007 at 07:04 AM PDT #
Posted by Dan Diephouse on July 30, 2007 at 10:10 AM PDT #