Return-Path: Delivered-To: apmail-cayenne-commits-archive@www.apache.org Received: (qmail 59862 invoked from network); 11 Jun 2009 12:13:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Jun 2009 12:13:20 -0000 Received: (qmail 35515 invoked by uid 500); 11 Jun 2009 12:13:31 -0000 Delivered-To: apmail-cayenne-commits-archive@cayenne.apache.org Received: (qmail 35491 invoked by uid 500); 11 Jun 2009 12:13:31 -0000 Mailing-List: contact commits-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cayenne.apache.org Delivered-To: mailing list commits@cayenne.apache.org Received: (qmail 35480 invoked by uid 99); 11 Jun 2009 12:13:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Jun 2009 12:13:31 +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.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Jun 2009 12:13:28 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 565FB234C004 for ; Thu, 11 Jun 2009 05:13:07 -0700 (PDT) Message-ID: <1548797278.1244722387339.JavaMail.jira@brutus> Date: Thu, 11 Jun 2009 05:13:07 -0700 (PDT) From: "Loiko Dima (JIRA)" To: commits@cayenne.apache.org Subject: [jira] Updated: (CAY-1220) A function to auto-map the DB relationships In-Reply-To: <308357805.1241528493142.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/CAY-1220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Loiko Dima updated CAY-1220: ---------------------------- Attachment: InferRelationships_1.txt > A function to auto-map the DB relationships > ------------------------------------------- > > Key: CAY-1220 > URL: https://issues.apache.org/jira/browse/CAY-1220 > Project: Cayenne > Issue Type: Task > Components: CayenneModeler GUI > Affects Versions: 3.0M5 > Reporter: Andrus Adamchik > Assignee: Andrus Adamchik > Attachments: InferRelationships.txt, InferRelationships_1.txt > > > (note that mapping Db to Obj relationships will be done via a separate Jira... This one deals with DbRelationships only) > We need to add a Modeler function that infers Db relationships in a given DataMap based on the DbAttribute naming conventions. This can be implemented inside the Modeler for now, although at some point later in the game we may extract the actual algorithm in the new cayenne-tools project. > 1. Add a menu item called "Infer Relationships" and a corresponding action in the Modeler under "Tools" below "Reengineer Database Schema". It should be active when a DataMap is selected in the project model, and inactive otherwise. > 2. When clicked, it should analyze the current DataMap, and infer relationships based on the naming conventions (see below). A dialog is presented to the user with all relationships that are about to be created listed with checkboxes (initially all checked), allowing user to uncheck individual relationships. Buttons in the bottom should be "Cancel" and "Create". Dialog look can be borrowed from Class Generation -> Entities (of course with different columns), with the "check all" checkbox on top. > 3. Algorithm for inferring the relationships should take into account the existing relationships over the same keys (i.e. avoid creating duplicates). > 4. Mapping 1..N: Primary key column (to-one part) should be mapped explicitly. To detect a foreign key use the following naming convention: column name should be "tablename_id", where "tablename" is a DbEntity name. > 5. Mapping 1..1: If the foreign key is also the only PK, map the relationship as 1..1. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.