You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Albert Lee (JIRA)" <ji...@apache.org> on 2008/03/18 19:01:25 UTC

[jira] Commented: (OPENJPA-430) Automatically remove hungarian notation from column names.

    [ https://issues.apache.org/jira/browse/OPENJPA-430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12579961#action_12579961 ] 

Albert Lee commented on OPENJPA-430:
------------------------------------

This feature intended to remove/truncate fields using the Hungarian notations to the form as described in the original append. However the following changes seems to do more than just transforming a field, i.e. " name = dict.getValidColumnName(name, local);"

--- openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/PersistenceMappingDefaults.java	2007/11/06 07:33:44	592318
+++ openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/PersistenceMappingDefaults.java	2007/11/06 07:36:55	592319
@@ -181,6 +181,12 @@
         if (target instanceof Column) {
             if (elem)
                 name = vm.getFieldMapping().getName();
+
+            if (isRemoveHungarianNotation())
+                name = removeHungarianNotation(name);
+
+            name = dict.getValidColumnName(name, local);
+
             col.setName(name + "_" + ((Column) target).getName());
         }
     }

This change has some undesired consequence that broke some previous application.  Specifically, if the field is a keyword (e.g. identity), a digit is appended to the name so a foreign key column is changed from, e.g.   identity_id to identity0_id.  If an application already has a table defined and no automatic synchronize mapping is specified, the application will fail. This name augmentation is not warranted because even though identity is a keyword but the combined foreign key column identity_id is NOT a keyword.

My question is what is the intended purpose of this name transformation and how does it play into the "remove Hungarian Notation" feature? 

As Patrick mentioned in his  last note, some function in Kodo test also failed.  Can this name transformation be removed ?

Albert Lee.

> Automatically remove hungarian notation from column names.
> ----------------------------------------------------------
>
>                 Key: OPENJPA-430
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-430
>             Project: OpenJPA
>          Issue Type: New Feature
>    Affects Versions: 1.1.0
>            Reporter: Ben Short
>            Priority: Minor
>             Fix For: 1.1.0
>
>         Attachments: OPENJPA-430-DOCS.patch, OPENJPA-430.patch
>
>
> Add a flag to switch on/off automatic truncation of hungarian fields when automatically generating column names.
> Fields such as mFoobar and strBarFoo would become columns named* foobar and barfoo respectivly.
> *Current naming DBDictionary rules would still apply.

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