Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 87348 invoked from network); 22 Oct 2010 05:12:40 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 22 Oct 2010 05:12:40 -0000 Received: (qmail 40848 invoked by uid 500); 22 Oct 2010 05:12:40 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 40686 invoked by uid 500); 22 Oct 2010 05:12:37 -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 40672 invoked by uid 99); 22 Oct 2010 05:12:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Oct 2010 05:12:36 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED 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, 22 Oct 2010 05:12:35 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o9M5CEqt000196 for ; Fri, 22 Oct 2010 05:12:15 GMT Message-ID: <30849181.21781287724334863.JavaMail.jira@thor> Date: Fri, 22 Oct 2010 01:12:14 -0400 (EDT) From: "Hugh (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-1850) Dynamic runtime @Table name configuration In-Reply-To: <8553841.25661287631107510.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OPENJPA-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12923758#action_12923758 ] Hugh commented on OPENJPA-1850: ------------------------------- The group of tables are not known at compile time. The specific table isn't known until runtime. I'd like to be able to add new tables at anytime and run a new instance of this application to service it. It's name is read from a table in another database or from the properties file. I agree it is slightly dangerous if the wrong table name is used, but at most it will throw an error because the structure is different. I have a byte code manipulator that I use to rewrite the @Table name annotation, but it never gets asked to load my class. I see every other class being loaded. The sql trace shows an error when the dummy table name is used. I'm using Thread.currentThread().setContextClassLoader(New TableClassLoader(Thread.currentThread().getContextClassLoader())); This is run in theMain class and I see the class I'm interested in being constructed after this. How can I get my ClassLoader to be used to load this class? I have a fully worked example I'll upload but it depends on the ASM bytecode manipulator and jtds. > Dynamic runtime @Table name configuration > ----------------------------------------- > > Key: OPENJPA-1850 > URL: https://issues.apache.org/jira/browse/OPENJPA-1850 > Project: OpenJPA > Issue Type: Improvement > Components: usability > Environment: All environments > Reporter: Hugh > > I'm wondering if there is a way to map multiple tables who's name won't be known until runtime to a single entity class. More specifically, My application uses a single entity which it knows the schema for, but not the table name until runtime. The applications has to read the table name from another know table after startup. All there is at deployment is the key into that table. The application consists of a farm of identical apps all running different configurations. They basically store data from different JMS queues to the database. > I can't find anything useful about this except some byte code manipulators which don't seem to work on the annotation since it appears that the class is already loaded. > I think there is a legitimate need for such an enhancement. I often have run into sqlServer users who don't know how to use segmented clustered indexing or can't install an Enterprise version so don't have access to this. They create multiple tables and use prepared statements. > This would enable other cheap dbms to be used without having to worry about locking and contention at the table level. > Does anyone have any opinions on this? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.