Cefn -

> I thought I'd already brought in runtime enhancement using the OpenJPA
agent.
You did and you also said you weren't able to get enhancement working... I
thought maybe a shotgun blast of information would get you going. :-)

> Can I manually configure the MethodInterceptor capabilities of a
Dependency Injector to explicitly trigger whatever augmentation is needed,
as described here? Are there examples of this being done elsewhere?
Not that I'm aware of.

> To achieve enhancement I used a post-compile enhance.xml Ant task,
combined with
-javaagent:lib/openjpa/openjpa-all-2.0.1.jar=jdoEnhance=true,scanDevPath=true
passed to the VM on launch. At this stage I've no idea which of these is
actually doing the enhancement and how, which is why I'm working to avoid a
skyhook programming model.
An easy way to figure out which approach actually enhanced your Entities
would be to look at a compiled .class file after running enhance.xml.
Decompile/javap the file and make sure it implements PersistenceCapable. If
it does, you can omit the -javaagent. I'd recommend enhancing at build time
via the script.

> skyhook programming model
I'm not familiar to that programming model...

> All the mechanisms seem to rely on the use of a persistence.xml file in
META-INF - pretty unsatisfactory to drop out of Java and into a type-unsafe
serialisation language, but I can't find an alternative mechanism.
This mechanism of using persistence.xml to configure your persistence unit
is something that is defined by the JPA spec.

> To get it working I've resorted to a manual list of strings inside
<class></class> elements. All classes (including abstract mapped
superclasses) had to be listed here, so the inheritance structures in Java
weren't being employed either!
Listing your classes has nothing to do with Java inheritance, it is a way to
inform OpenJPA of the Entities to operate over. This is how we know whether
or not we should enhance a given type... or when you execute a query "Select
p FROM Person p" we know that Person is mapped to foo.Person.class.

> Is there a way to simply pass a list of classes into a Java method in an
unmodified VM, recursively trigger introspection of a whole package or even
have my java persistence invocations configure things?
Are you asking if there is a way that OpenJPA will auto configure a
persistence unit for you? If so, I don't know of any such magic.

Thanks,
Rick

On Wed, Nov 17, 2010 at 4:11 AM, <[email protected]> wrote:

> Thanks for getting back to me. The enhancement link is relevant, but as I
> mentioned in the original mail, I thought I'd already brought in runtime
> enhancement using the OpenJPA agent.
>
> Using Java invocation would be hugely preferable. Can I manually configure
> the MethodInterceptor capabilities of a Dependency Injector to explicitly
> trigger whatever augmentation is needed, as described here? Are there
> examples of this being done elsewhere?
> http://code.google.com/p/google-guice/wiki/AOP
>
> To achieve enhancement I used a post-compile enhance.xml Ant task, combined
> with
> -javaagent:lib/openjpa/openjpa-all-2.0.1.jar=jdoEnhance=true,scanDevPath=true
> passed to the VM on launch. At this stage I've no idea which of these is
> actually doing the enhancement and how, which is why I'm working to avoid a
> skyhook programming model.
>
> All the mechanisms seem to rely on the use of a persistence.xml file in
> META-INF - pretty unsatisfactory to drop out of Java and into a type-unsafe
> serialisation language, but I can't find an alternative mechanism. To get it
> working I've resorted to a manual list of strings inside <class></class>
> elements. All classes (including abstract mapped superclasses) had to be
> listed here, so the inheritance structures in Java weren't being employed
> either!
>
> Is there a way to simply pass a list of classes into a Java method in an
> unmodified VM, recursively trigger introspection of a whole package or even
> have my java persistence invocations configure things? The MethodInterceptor
> model would be the ideal way to go for me, but I don't want to go so far
> under the hood that it clicks shut behind me.
>
> Cefn
> http://cefn.com
> ________________________________________
> From: Rick Curtis [[email protected]]
> Sent: 16 November 2010 15:54
> To: [email protected]
> Subject: Re: OpenJPA Enhancement fail - suggestions?
>
> How are you enhancing your classes? Please take a read through this
> page[1].
>
> [1] http://openjpa.apache.org/entity-enhancement.html
>
> Thanks,
> Rick
>

Reply via email to