TomEE and OpenEJB got recently some deploy time enhancement features.
Deploy time enhancement : What is it?
Currently, it is available only for OpenJPA.
This feature is interesting. In fact, the best way to enhance entities with OpenJPA was to use the javaagent (activated by default in openejb). But this solution is not all clean. Without enhancing your entities, you (generally) have bad performances and some features are missing (even with others providers…yes, even hibernate!). Thus, you had to enhance your entities at build time…so your byte code was modified 😦 (but very often, in real life, that’s not an issue).
The advantage to deploy time enhancement is that byte code is modified but only in the deployment binaries.
How to activate it?
First, ask for deploying time enhancement, as usually done with OpenEJB/TomEE, add a system property: openejb.jpa.deploy-time-enhancement=true
Then this feature has some more configuration (properties too):
It simply defines which files should be included/excluded. The format is java regex one and is applied on file paths.
What does it do?
It will enhance selected jars (or all if no include/exclude is configured) with OpenJPA PCEnhancer (used by openjpa maven plugin). To enhance them, it will explode them, then repackage them. The original jars will be deleted and a new one will be created with the suffix -enhanced.
If you have any need concerning this feature or any issue, feel free to post a mail to firstname.lastname@example.org, we’ll try our best to make this feature better ;).