Return-Path: X-Original-To: apmail-incubator-empire-db-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-empire-db-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 080AC4B10 for ; Wed, 29 Jun 2011 13:13:08 +0000 (UTC) Received: (qmail 91312 invoked by uid 500); 29 Jun 2011 13:13:08 -0000 Delivered-To: apmail-incubator-empire-db-dev-archive@incubator.apache.org Received: (qmail 91280 invoked by uid 500); 29 Jun 2011 13:13:07 -0000 Mailing-List: contact empire-db-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: empire-db-dev@incubator.apache.org Delivered-To: mailing list empire-db-dev@incubator.apache.org Received: (qmail 91265 invoked by uid 99); 29 Jun 2011 13:13:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Jun 2011 13:13:06 +0000 X-ASF-Spam-Status: No, hits=4.0 required=5.0 tests=FREEMAIL_FROM,FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mdehoust@gmail.com designates 209.85.212.47 as permitted sender) Received: from [209.85.212.47] (HELO mail-vw0-f47.google.com) (209.85.212.47) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Jun 2011 13:13:02 +0000 Received: by vws2 with SMTP id 2so964379vws.6 for ; Wed, 29 Jun 2011 06:12:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=OQBMzP4hjphIGxyUa83Obaq45J1zf1S2MFqZCHYFV0s=; b=Sqw48uHCn8SJkF2YjLWRq3uE2rim0PQdRlenqdzxObqiwHr8RlACrAYcTo9GLJSsul TmsDXd0k5KFWoutEoSvOjdM53grHPgjhnbTvo2auX8eifkzLpez3o3Zpg41pBTj5a/Zb 4wRwlSXISNtm06PHPXsUN41Sw0/t/iE+gDqNU= MIME-Version: 1.0 Received: by 10.220.5.207 with SMTP id 15mr6029vcw.226.1309353160713; Wed, 29 Jun 2011 06:12:40 -0700 (PDT) Received: by 10.220.186.76 with HTTP; Wed, 29 Jun 2011 06:12:40 -0700 (PDT) In-Reply-To: References: <4E0A67DA.5070509@arcor.de> Date: Wed, 29 Jun 2011 09:12:40 -0400 Message-ID: Subject: Re: Relationships From: Matt DeHoust To: =?ISO-8859-1?Q?Rainer_D=F6bele?= Cc: empire-db-user@incubator.apache.org, empire-db-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=0022152d830107a64004a6d98a8c --0022152d830107a64004a6d98a8c Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thank you Benjamin and Rainer. I have subscribed to the dev list. I'll take a look at the code when I return from vacation and follow up using the dev list with any questions or ideas. I hope to have a chance to look into it this weekend. -Matt On Wed, Jun 29, 2011 at 6:30 AM, Rainer D=F6bele wrote: > Hi everyone,**** > > ** ** > > I think this is an important improvement of the code generator that we > should implement.**** > > I have created a Jira Issue for this:**** > > ** ** > > https://issues.apache.org/jira/browse/EMPIREDB-110**** > > ** ** > > Matt, if you feel you can and want to do It, then we would certainly > appreciate this.**** > > You may create a patch file and attach it to the JIRA ticket.**** > > Then we can apply the patch and commit the code to svn.**** > > ** ** > > For further discussion I would recommend to move to the dev-mailing list:= * > *** > > empire-db-dev@incubator.apache.org**** > > ** ** > > Thanks, **** > > Rainer**** > > ** ** > > ** ** > > *Von:* Benjamin Venditti [mailto:benjamin.venditti@arcor.de] > *Gesendet:* Mittwoch, 29. Juni 2011 01:47 > *An:* empire-db-user@incubator.apache.org > *Cc:* Matt DeHoust > *Betreff:* Re: Relationships**** > > ** ** > > Hi Matt, > > thanks for your interest in empire-db. > > regarding your request ... unfortunately the codegen does not set up the > relation of the database model. > At the moment the codegen will only set up views and tables. We thought > these are the most important for the most people as they are usually > sufficient for simple data access. > > However i think there are two occasions where the relations are important= : > - database creation > - deletion of records with cascading deletion enabled > > At the moment we have not planned to add "relationship generation" to th= e > codegen component, but I am glad to hear that you consider to extend it o= n > your own. > > The right place to start with that would be: > * CodeGenParser.populateDatabase(..) : 131* : This is the point where > the DatabaseMetaData is querried and used to populate empire-db's model > *CodeGenWriter.generateCodeFiles(..) : 125* : Is used to serialize th= e > populated model as java code > *src/main/resources/Database.vm : 70* : This is the velocity templat= e > we use to create the java class for the database. > > In its default constructor you'd need to add a line for each relationship > similar to this: > > *addRelation( > EMPLOYEES.DEPARTMENT_ID.referenceOn( DEPARTMENTS.DEPARTMENT_ID ));* > > I hope this is of some help to you. Feel free to ask if you have further > questions! > > Cherio > Benjamin > > Am 28.06.2011 19:37, schrieb Matt DeHoust: **** > > Hello, **** > > ** ** > > I see that the empire-db model supports relationships (for example > DBDatabase.getRelations()), but it doesn't seem that the codegen componen= t > sets them up. Am I missing something? (I am using MySQL if that matters.)= * > *** > > ** ** > > If not, are there plans to introduce relationship setup in the codegen > component?**** > > ** ** > > If not, where should I look to add them myself? CodeGenParser?**** > > ** ** > > Thanks,**** > > Matt**** > > ** ** > > P.S. I apologize if I posted this question twice by mitake.**** > > ** ** > --0022152d830107a64004a6d98a8c--