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 2014/03/17 08:50:44 UTC

[jira] [Commented] (CAY-1871) cdbimport: better naming of multiple relationships to the same entity

    [ https://issues.apache.org/jira/browse/CAY-1871?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13937527#comment-13937527 ] 

Andrus Adamchik commented on CAY-1871:
--------------------------------------

This patch requires more work:

1. It only fixes BasicNamingStrategy. We also need to fix SmartNamingStrategy (which is actually much more sane that Basic*)

2. Compiling a pattern right before use is expensive. Pattern must be cached as an ivar

3. In general using FK name to build to-many name looks odd ("paintings" is an ok name, but "artistPaintings" is not). So maybe we fail over to the "fk + tablename" pattern only if there are 2 relationships present between the 2 given tables?

Oh well... Generating natural language names from column names is hard ... 

> cdbimport: better naming of multiple relationships to the same entity
> ---------------------------------------------------------------------
>
>                 Key: CAY-1871
>                 URL: https://issues.apache.org/jira/browse/CAY-1871
>             Project: Cayenne
>          Issue Type: Improvement
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>         Attachments: cay1871.patch
>
>
> Say we have the following tables:
> team:
>   ID PK
> game: 
>   ID PK
>   HOME_TEAM_ID FK
>   AWAY_TEAM_ID FK
> cdbimport reverse engineering results in correct property names in Game ('homeTeam', 'awayTeam'), but confusingly named reverse relationships from Team ('games', 'games1'). Wonder if we can devise an algorithm to name reverse  reslationships something more meaningful based on the FK name too? Maybe 'homeTeamGames' / 'awayTeamGames'?
> This is not limited to 'cdbimport'. IIRC Modeler does a similar thing. It is just that fixing naming in the Modeler is easier.



--
This message was sent by Atlassian JIRA
(v6.2#6252)