Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CE983D6D3 for ; Tue, 14 Aug 2012 14:13:12 +0000 (UTC) Received: (qmail 71912 invoked by uid 500); 14 Aug 2012 14:13:12 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 71892 invoked by uid 500); 14 Aug 2012 14:13:12 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 71884 invoked by uid 99); 14 Aug 2012 14:13:12 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Aug 2012 14:13:12 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FSL_RCVD_USER,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mkienenb@gmail.com designates 209.85.216.171 as permitted sender) Received: from [209.85.216.171] (HELO mail-qc0-f171.google.com) (209.85.216.171) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 Aug 2012 14:13:04 +0000 Received: by qcad1 with SMTP id d1so563570qca.16 for ; Tue, 14 Aug 2012 07:12:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=84waEiGAGw02Xyn8x/5Rv+zd0qPeC5iiLh3jelKf5zs=; b=bwH1+iBL+sfPRHZJ8VKYbn8rK2YnAPpwYQVzhA9Itay1bZowv7svfJNlNVqSM4U0pI UHetvS+PqQ9C5MgjnhaaPJSaavmM3CtFtAbz9iphFSixaHc6AxrlJe45LNhl8B3MAHqM bbhcvKbbEiaotPZcBlu3E2uZ6ijZwskm/ORyB/pUZglQOyvbRsRqCI1eUSpZXPpl+HQD tsVXt2XdPcX48etv1G2KcMDxGG+gHA1vvq4F5qMkCDZVNJKtT7crh8dzHz7txQKXUL/p MdedwB4Makgom1BYVFLDXwaGsSF1r/O1zzwHwuNreBfwSOG8x8UrpQZTUQ5iQFBEa4fH Y+Bg== Received: by 10.224.58.142 with SMTP id g14mr32933761qah.96.1344953563747; Tue, 14 Aug 2012 07:12:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.230.139 with HTTP; Tue, 14 Aug 2012 07:12:23 -0700 (PDT) In-Reply-To: <5029E8D8.2000500@hispeed.ch> References: <494D7117.1040507@hispeed.ch> <50296E82.1040704@hispeed.ch> <5029E8D8.2000500@hispeed.ch> From: Mike Kienenberger Date: Tue, 14 Aug 2012 10:12:23 -0400 Message-ID: Subject: Re: Database generation SQL script creation in background To: user@cayenne.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org If you want to do it from java code, this is how I used to set up test databases in Cayenne 1.1. It's probably slightly different now. public static void createSchemaForObjEntityName(Configuration configuration, String objEntityName) throws Exception { DataNode dataNode = getDataNodeForConfigurationAndObjEntityName(configuration, objEntityName); DataSource dataSource = dataNode.getDataSource(); DbAdapter dbAdapter = dataNode.getAdapter(); Iterator dataMapIterator = dataNode.getDataMaps().iterator(); while (dataMapIterator.hasNext()) { DataMap dataMap = (DataMap) dataMapIterator.next(); DbGenerator dbGenerator = new DbGenerator(dbAdapter, dataMap); boolean notCleanState = true; // if (CayenneTestDatabaseFramework.isHsqldbDriver()) // { // // assume we're using the in-memory version // notCleanState = false; // } dbGenerator.setShouldDropTables(notCleanState); dbGenerator.setShouldDropPKSupport(notCleanState); dbGenerator.setShouldCreatePKSupport(true); dbGenerator.setShouldCreateTables(true); dbGenerator.setShouldCreateFKConstraints(false); dbGenerator.runGenerator(dataSource); } } On Tue, Aug 14, 2012 at 1:57 AM, Martin Weber wrote: > Hi John, > > main purpose is to make a fresh database installation during an automated > nightly build. After the build I have scripts which create databases and > then load data and run tests. The creation is only possible if I don't need > a GUI. But I think the cdbgen ant task could be what I'm looking at. > > Cheers, > Martin > > > On 14.08.2012 05:38, John Huss wrote: >> >> For what purpose? What is your broader goal? There are a few different >> ways of creating the scheme using Cayenne. >> >> John >> >> On Monday, August 13, 2012, Martin Weber wrote: >> >>> Hi, >>> >>> Is there a solution to create the database generation SQL script without >>> starting the GUI modeler ? I would like to create the db generation >>> script >>> within an ant task or a shell/batch script. >>> >>> Thanks, >>> Martin >>> >> >