Entity EnhancementPage edited by Donald Woods
Comment:
added link to user docs
Changes (1)
Full ContentWhat is Enhancement Anyway?The JPA spec requires some type of monitoring of Entity objects, but the spec does not define how to implement this monitoring. Some JPA providers auto-generate new subclasses or proxy objects that front the user's Entity objects at runtime, while others use byte-code weaving technologies to enhance the actual Entity class objects at build time. OpenJPA supports both methods, but strongly suggests only using the build time enhancement. For complete details on entity enhancement, please checkout the section in the latest User's Guide on Enhancement. The following sections will only cover the high-level concepts and the ways to use the enhancer in different build and runtime setups. Build Time EnhancementBuild time enhancement is the recommended method to use with OpenJPA, as it it the fastest and most reliable method. Please follow the links below based on your development environment: Runtime EnhancementWhen running in a Java SE environment or in a non-Java EE 5 compliant container, OpenJPA defaults to using runtime subclassing enhancement. The subclassing enhancement support was added originally as a convenience to new developers to reduce the amount of work to get a 'HelloWorld-ish' OpenJPA application working out of the box. It was never meant to run in production. So you're probably thinking that this sounds great! OpenJPA handles enhancement automatically for me and I can stop reading this post. Wrong! Subclassing has two major drawbacks. First off, it isn't nearly as fast as byte-code enhancement and the second drawback is that there are some documented functional problems when using the subclassing support. The moral of the story is, don't use this method of enhancement. If you really want to use runtime enhancement, the following Runtime Enhancement page describes how to use the -javaagent setting in ANT and Eclipse projects. Additional information regarding the subclassing enhancement can be found in the OpenJPA docs. Dynamic EnhancementOPENJPA-952 added the capability to have OpenJPA attempt to dynamically load the javaagent enhancer. If you see the following message, OpenJPA loaded the enhancer dynamically.
This method of enhancement is intended for first time users or developers as it has a number of caveats.
If your application uses some other method of enhancement, this support can be disabled by setting the following property in your persistence.xml.
Author AttributionThe content for this page and sub-pages was adapted from content created by OpenJPA contributor Rick Curtis from the following WebSphere and Java Persistence blog entries:
Change Notification Preferences
View Online
|
View Changes
|
Add Comment
|
- [CONF] OpenJPA > Entity Enhancement confluence
- [CONF] OpenJPA > Entity Enhancement confluence
- [CONF] OpenJPA > Entity Enhancement confluence
