You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (JIRA)" <ji...@apache.org> on 2009/09/02 11:02:33 UTC

[jira] Closed: (CAY-1220) A function to auto-map the DB relationships

     [ https://issues.apache.org/jira/browse/CAY-1220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrus Adamchik closed CAY-1220.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 3.0 beta 1

> 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
>             Fix For: 3.0 beta 1
>
>         Attachments: cay-1220.txt, combo.txt, combo1.txt, combo2.txt, combo_3.txt, inferCombo.txt, InferRelationships.txt, InferRelationships_2.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.