openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simone Gianni <>
Subject OpenJPA enhancement in classloader
Date Mon, 21 Jul 2008 16:53:19 GMT
Hi All,
for a number of reasons I cannot explain right now ( :) ), I need to
load JPA annotated classes, and enhance them with OpenJPA, from a
ClassLoader, and not from an agent or a J2EE environment. I wrote a
classloader that calls the PCClassFileTransformer inside the defineClass
method, I used the code in the PCEnhancerAgent class to do this, and I
see the classes being (properly ?) rewritten.

BUT, when the class is then used by OpenJPA, it uses a different
OpenJPAConfiguration, which returns a different MetadataFactory
(different instance), and an error is raised as if the class was not

I don't see how to force OpenJPA to use the same configuration/metadata
used by the PCClassFileTransformer, and don't even understand if this is
somehow a way to proceed or if there is another (maybe simpler and
smarter) solution.

Got any idea?

Thanks in advance,

Simone Gianni
CEO Semeru s.r.l.
Apache Committer

View raw message