Adam, Interesting questions, which could have very lengthy answers... But, let's start and see where it takes us...
On Fri, Jan 30, 2009 at 11:05 AM, Adam Hardy <[email protected]>wrote: > > One of the projects I work on is a framework that is designed to be used > with any JPA provider, and the testing runs against OpenJPA as well as > Hibernate and Toplink Essentials. > > Obviously I don't want the javaagent to act on my entity classes when I'm > running Hibernate or Toplink, but there appears to be no easy way to stop it > from one test to another in a batch run. Right. If your jvm invocation contains the -javaagent parameter, OpenJPA does not have another overriding option that would turn off that processing. That's an interesting request, but we don't have anything like that right now. We have options that you can specify on the javaagent parameter that tells OpenJPA "how much class redefinition" we should do, but if you're going to modify that javaagent parameter, then you might as well remove it. You are welcome to open a JIRA feature for that request. > It would be interesting to know whether there are plans to abandon the byte > code rewriting, and what the history behind its adoption is. I would assume > that it's performance but I haven't had seen any comparative stats between > the different JPA providers. Each JPA provider has picked thier poison and decided on the mechanism for intercepting Entity interactions. Hibernate went the sub-classing route, while most of the other providers went with the byte-code weaving approach. >From an out-of-the-box experience, Hibernate's approach seems easier. OpenJPA started down that path also. We provide a sub-classing mechanism if normal enhancement has not been detected. But, we hit some roadblocks with this sub-classing approach as they pertain the rest of our architecture. Thus, it's not really ready for prime time. There are many advantages to the enhancement processing. Overall, our performance is better with byte-code enhancement. The industry benchmarks seem to back up this claim. But, where we would like to get is to do the bytecode enhancement without any special options or processing by the user. The Java 6 feature for class redefinition may give us that possibility. We would like to automatically detect whether enhancement has been specified and, if it hasn't, insert our enhancement processing into the classloading mechanism automatically. Prior to Java 6, we had to rely on the javaagent parameter, or the app server's container hooks, or static enhancement. Hopefully, Java 6 will allow us to improve on this processing. Hope this helps explain. We have some of the same concerns and are looking to improve on them. Kevin > > Regards > Adam > > > > > Kevin Sutter on 30/01/09 15:57, wrote: > >> Hi Gianny, >> I use this all the time. On my Run configuration for the application that >> I >> am running I will put something like the following as a JVM argument... >> >> >> -javaagent:C:/eclipse.workspaces/3.2.2/openjpa-1.2.0/openjpa-all/target/openjpa-1.2.0.jar >> >> This should kick in the PCEnhancerAgent for the Entity classes that are >> being loaded. >> >> Kevin >> >> On Fri, Jan 30, 2009 at 3:53 AM, Gianny Damour < >> [email protected]> wrote: >> >> Hi, >>> >>> I am unable to get javaagent based enhancement work within Eclipse. >>> >>> Based on a cursory review of PCEnhancerAgent, I can see that no >>> ClassFileTransformer is installed when >>> >>> List<String> anchors = Configurations. >>> getFullyQualifiedAnchorsInPropertiesLocation(opts); >>> >>> returns an empty list, which it does in my case when I simply specify the >>> following JVM arg >>> >>> -javaagent:<path to>/openjpa-1.2.0.jar >>> >> >
