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

Andrey Razumovsky commented on CAY-402:
---------------------------------------

I've commited new Naming Strategy feature, as discussed in [1]. Now user can 
choose naming strategy at reverse engineering dialog. Two strategies are 
distributed: BasicNamingStrategy, which creates names as it was done before 
(with 'to', 'array' and so on); and new one, SmartNamingStrategy (which is in 
the modeler so that inflector dependency is not included in 1.5-unpublished. 
Advantages include:
-Using of FK names at generating relationship names
-Dropping 'to' prefix for obj relationships and therefore for generated class 
methods' names - only if FK column  name ends with 'ID' or '_ID'
-Using pluralized form instead-of "ARRAY" suffix for to-many relationships 
(i.e. 'adresses'  instead-of 'addressArray')
User can use his own strategy if jar with it is attached in Cayenne properties.

**** I do NOT close this issue (and CAY-457) yet. Smart strategy works fine for 
my databases, at least I like it much more that previous one. But it'll be 
better if other developers check it with their DBs, maybe naming algorithm 
should be improved in some way.

[1] http://mail-archives.apache.org/mod_mbox/cayenne-dev/200808.mbox/[EMAIL 
PROTECTED]

> Entity/Attribute/Relationship naming improvements on rverse-engineering
> -----------------------------------------------------------------------
>
>                 Key: CAY-402
>                 URL: https://issues.apache.org/cayenne/browse/CAY-402
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Cayenne Core Library, CayenneModeler GUI
>    Affects Versions: UNDEFINED FUTURE
>            Reporter: Andrus Adamchik
>            Assignee: Andrey Razumovsky
>             Fix For: UNDEFINED FUTURE
>
>
> Users should be given some flexibility when it comes to default names 
> generated during reverse engineering. E.g. there were requests to 
> automatically change plural form to singular ("product_groups" -> 
> "ProductGroup"). There maybe other user-specific cases for transforming DB 
> name to Java name. 
> Suggested solution was to allow entering regex-based rules in the Modeler:
> http://objectstyle.org/cayenne/lists/cayenne-user/2005/11/0104.html 
> Another related request suggested to have an option for naming relationships 
> using attribute names instead of target entity names. This may also be one of 
> the rules:
> http://objectstyle.org/cayenne/lists/cayenne-user/2005/11/0106.html
> Another suggestion by Cris - store the rules in DataMap for possible reverse 
> engineering with Ant. This should allow model synching directly against the 
> database (but would of course require a special Ant task)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to