Return-Path: Delivered-To: apmail-openjpa-users-archive@locus.apache.org Received: (qmail 88816 invoked from network); 17 Dec 2008 12:04:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Dec 2008 12:04:36 -0000 Received: (qmail 36748 invoked by uid 500); 17 Dec 2008 12:04:49 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 36732 invoked by uid 500); 17 Dec 2008 12:04:48 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 36721 invoked by uid 99); 17 Dec 2008 12:04:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Dec 2008 04:04:48 -0800 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of phanibalaji.madgula@gmail.com designates 209.85.146.179 as permitted sender) Received: from [209.85.146.179] (HELO wa-out-1112.google.com) (209.85.146.179) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Dec 2008 12:04:27 +0000 Received: by wa-out-1112.google.com with SMTP id m33so2856903wag.9 for ; Wed, 17 Dec 2008 04:04:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=ts4NbTTdYclzO85N4b3qZU3ii5M41uc5GBcm/MR+V6w=; b=WwsM2hOJrEPrKbTiNPDyvmKRhUUG/5o5LUcNU/IAl88/3ywCK3qyXA92oGiJBV3b7O SofQqOK1dyPgIWeIDsHLZpc9o+bilIuW8CMfIen15tvUojPZFFiRywX/FV8IuvqP1YM7 b0gyp89kmDYlnSvpFafPR1XM8ugVX34dMSeBo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=v4ZOpS0SgJTV6S1Od79kpzotQ0K3g9yI8oh4Ck4hYN9Yp5oJNgvR22X0selv5IbreX 3GV3cC75WCcBVizPvzTBSMrwOXQTQIaBLFzfiVj3BB3EFOlDV1kCrVJakIQ+pHzihLsR q5duFKauaYk/blKFQrl252Kjf4VL9unJWFJYw= Received: by 10.115.110.15 with SMTP id n15mr304744wam.16.1229515447206; Wed, 17 Dec 2008 04:04:07 -0800 (PST) Received: by 10.114.168.2 with HTTP; Wed, 17 Dec 2008 04:04:06 -0800 (PST) Message-ID: <83e2fc4d0812170404l2c974146m4a5a196e04e16ce@mail.gmail.com> Date: Wed, 17 Dec 2008 17:34:07 +0530 From: "Phani Madgula" To: users@openjpa.apache.org Subject: Re: Can somebody tell me how to generate DDLs In-Reply-To: <72c1350f0812161323y3c4bd42fta33fb32fbcc1b6c3@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <83e2fc4d0812160423n59029e15ne4a7cb0f3b545c29@mail.gmail.com> <1229459515674-1664781.post@n2.nabble.com> <72c1350f0812161323y3c4bd42fta33fb32fbcc1b6c3@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org Thanks for info...I am able to generate the DDLs into a file. The MappingTool requires database connection though. Thanks Phani On 12/17/08, Michael Dick wrote: > Hi all, > > If a connection to the database is not available (or desired) you can try > something like this. > > Assumptions : > 1. target/classes contains your compiled classes > 2. target/classes/META-INF/persistence.xml exists and includes a list of > your entities > 3. ${OPENJPA_LOC} contains openjpa.jar > 4. ${OPENJPA_LOC}/lib includes the dependencies from our binary archive > 5. The example uses derby, you can use db2, oracle or any of the > DBDictionary classes included with OpenJPA > > $ export CLASSPATH=target/classes:${OPENJPA_LOC}/openjpa.jar > $ java -cp ${CLASSPATH} -Djava.ext.dirs=${OPENJPA_LOC}/lib > org.apache.openjpa.jdbc.meta.MappingTool -sql temp.ddl -sa build > -DBDictionary derby > > This will generate temp.ddl with the assumption that none of the tables > exist. > > You can do something similar in ant with syntax similar to this : > classname="org.apache.openjpa.jdbc.ant.MappingToolTask" > classpathref="openjpa.cp"/> > . . . > > > > > Hope this helps, > -mike > > On Tue, Dec 16, 2008 at 2:31 PM, Pinaki Poddar wrote: > >> >> $ java org.apache.openjpa.jdbc.meta.MappingTool -sql test.ddl -p >> persistence.xml >> >> classpath should have >> a) openjpa libraries >> b) a directory X such that X/META-INF/persistence.xml exists >> >> persistence.xml should declare the classes you want to generate DDL for in >> clause. >> AFAIR, there were some issues with generating DDL without a database >> connection. So specify a database configuration in persistence.xml also. >> >> If you have many persistence unit defined in persistence.xml but want only >> a >> specific persistence unit (say Y) to be processed then append it as >> follows >> >> $ java org.apache.openjpa.jdbc.meta.MappingTool -sql test.ddl -p >> persistence.xml#Y >> >> -- >> View this message in context: >> http://n2.nabble.com/Can-somebody-tell-me-how-to-generate-DDLs-tp1662488p1664781.html >> Sent from the OpenJPA Users mailing list archive at Nabble.com. >> >> >