From open-jpa-dev-return-2720-apmail-incubator-open-jpa-dev-archive=incubator.apache.org@incubator.apache.org Fri Mar 16 00:01:30 2007 Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 62642 invoked from network); 16 Mar 2007 00:01:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Mar 2007 00:01:29 -0000 Received: (qmail 71251 invoked by uid 500); 16 Mar 2007 00:01:37 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 71216 invoked by uid 500); 16 Mar 2007 00:01:37 -0000 Mailing-List: contact open-jpa-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: open-jpa-dev@incubator.apache.org Delivered-To: mailing list open-jpa-dev@incubator.apache.org Received: (qmail 71207 invoked by uid 99); 16 Mar 2007 00:01:37 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Mar 2007 17:01:37 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [192.18.42.249] (HELO nwk-ea-fw-1.sun.com) (192.18.42.249) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Mar 2007 17:01:25 -0700 Received: from d1-sfbay-09.sun.com ([192.18.39.119]) by nwk-ea-fw-1.sun.com (8.13.6+Sun/8.12.9) with ESMTP id l2G014hI008136 for ; Thu, 15 Mar 2007 16:01:05 -0800 (PST) Received: from conversion-daemon.d1-sfbay-09.sun.com by d1-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) id <0JEY00F01YLZXH00@d1-sfbay-09.sun.com> (original mail from Marina.Vatkina@Sun.COM) for open-jpa-dev@incubator.apache.org; Thu, 15 Mar 2007 17:01:04 -0700 (PDT) Received: from sun.com ([129.150.18.45]) by d1-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPSA id <0JEY004XOYPOWO30@d1-sfbay-09.sun.com> for open-jpa-dev@incubator.apache.org; Thu, 15 Mar 2007 17:01:01 -0700 (PDT) Date: Thu, 15 Mar 2007 17:01:00 -0700 From: Marina Vatkina Subject: Using DDL generation in a Java EE environment? Sender: Marina.Vatkina@Sun.COM To: open-jpa-dev@incubator.apache.org Message-id: <45F9DE3C.5020202@sun.com> MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=us-ascii Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.4) Gecko/20040414 X-Virus-Checked: Checked by ClamAV on apache.org Hi, I am part of the GlassFish persistence team and was wondering how does OpenJPA support JPA auto DDL generation (we call it "java2db") in a Java EE application server. Our application server supports java2db via creating two sets of files for each PU: a ...dropDDL.jdbc and a ...createDDL.jdbc file on deploy (i.e. before the application is actually loaded into the container) and then executing 'create' file as the last step in deployment, and 'drop' file on undeploy or the 1st step in redeploy. This allows us to drop tables created by the previous deploy operation. This approach is done for both, the CMP and the default JPA provider. It would be nice to add java2db support for OpenJPA as well, and I'm wondering if we need to do anything special, or it'll all work just by itself? Here are my 1st set of questions: 1. Which API would trigger the process, assuming the correct values are specified in the persistence.xml file? Is it: a) .createContainerEntityManagerFactory(...)? or b) the 1st call to emf.createEntityManager() in this VM? c) something else? 2. How would a user drop the tables in such environment? 3. If the answer to either 1a or 1b is yes, how does the code distinguish between the server startup time and the application being loaded for the 1st time? 4. Is there a mode that allows creating a file with the jdbc statements to create or drop the tables and constraints? thank you, -marina