Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 55186 invoked from network); 29 Oct 2010 07:15:45 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 29 Oct 2010 07:15:45 -0000 Received: (qmail 20290 invoked by uid 500); 29 Oct 2010 07:15:45 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 20128 invoked by uid 500); 29 Oct 2010 07:15:45 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 20118 invoked by uid 99); 29 Oct 2010 07:15:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Oct 2010 07:15:44 +0000 X-ASF-Spam-Status: No, hits=-1998.7 required=10.0 tests=ALL_TRUSTED,URI_HEX X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Oct 2010 07:15:41 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o9T7FJL0021390 for ; Fri, 29 Oct 2010 07:15:19 GMT Message-ID: <29365944.137911288336519224.JavaMail.jira@thor> Date: Fri, 29 Oct 2010 03:15:19 -0400 (EDT) From: "Hugh (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-1860) How do I get OpenJPA to use my custom classloader to load Entity classes? In-Reply-To: <25491929.111661288236680439.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/OPENJPA-1860?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12926193#action_12926193 ] 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: https://issues.apache.org/jira/browse/OPENJPA-1860 > 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? (http://openjpa.208410.n2.nabble.com/Dynamic-Table-value-td5645906.html) > 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.