openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hugh (JIRA)" <>
Subject [jira] Commented: (OPENJPA-1860) How do I get OpenJPA to use my custom classloader to load Entity classes?
Date Fri, 29 Oct 2010 07:15:19 GMT


Hugh commented on OPENJPA-1860:

So I found out what a javaagent is, and I hooked my transformer into it and registered one
for the startup.
It doesn't do the trick. I can see it loads and is called for almost all classes, but it never
gets asked to transform the class I'm interested in.
Maybe it's the race condition you spoke of. Apparently M$ win this round. There's no portable
way to modify the @Table name attribute of an OpenJPA  Entity class at runtime using a javaagent.

To answer your other questions Kevin. I'm letting OpenJPA act as the java agent at runtime.
I don't convert them at build time. Would this make any difference?
My guess is that the @Table annotation would be stripped and I'd need to think of a new way
to modify the byte code. Any clues?

> How do I get OpenJPA to use my custom classloader to load Entity classes?
> -------------------------------------------------------------------------
>                 Key: OPENJPA-1860
>                 URL:
>             Project: OpenJPA
>          Issue Type: Question
>          Components: jpa
>    Affects Versions: 2.0.1
>         Environment: OpenJPA 2.0.1 Java 1.6-22
>            Reporter: Hugh
> I have written a custom classloader and I can't work out how to get OpenJPA to use it
to load my entity classes.
> I've followed instructions I found to set Thread.currentThread().setContextClassLoader()
at startup before loading any EntityManager and it seems to load the OpenJPA classes and a
lot of others, but not the class I'm interested in.
> Is this the right approach?
> If so, where have I gone wrong? (
> If not, how should this be done?
> Is there some sort of guide to accomplishing this that someone could point me to?
> Thanks.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message