You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Ben Short (JIRA)" <ji...@apache.org> on 2007/11/02 23:51:50 UTC

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

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


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.


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

Posted by "Ben Short (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540458 ] 

Ben Short commented on OPENJPA-430:
-----------------------------------

Can the current patch be removed and I'll replace with one that updates the documentation?

> 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
>         Attachments: 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.


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

Posted by "Patrick Linskey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540474 ] 

Patrick Linskey commented on OPENJPA-430:
-----------------------------------------

I already submitted the old patch; just update your environment and add docs (in the openjpa-project dir) and add the new diff.

Thanks for the work on this feature, btw.

> 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
>         Attachments: 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.


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

Posted by "Patrick Linskey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-430?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Patrick Linskey resolved OPENJPA-430.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.1.0

FTR, this was addressed in r592319 originally. That svn commit did not get associated for some reason.

> 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.


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

Posted by "Kevin Sutter (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540455 ] 

Kevin Sutter commented on OPENJPA-430:
--------------------------------------

Documentation updates as well?  This is especially important when adding new properties.  Thanks!

> 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
>         Attachments: 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.


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

Posted by "Albert Lee (JIRA)" <ji...@apache.org>.
    [ 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.


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

Posted by "Pinaki Poddar (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-430?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12580111#action_12580111 ] 

Pinaki Poddar commented on OPENJPA-430:
---------------------------------------

This feature should be removed because

A) MappingDefaults is inappropriate place for introduction of a rather specific naming semantics. An extended user-defined (or pre-packaged) plug-in should do it. 
B) It broke my code several times :( Especially when Column names matched database reserved words. 





> 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.


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

Posted by "Ben Short (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-430?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ben Short updated OPENJPA-430:
------------------------------

    Attachment: OPENJPA-430-DOCS.patch

Patch that provides documentation for this feature.

> 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
>         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.


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

Posted by "Ben Short (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-430?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ben Short updated OPENJPA-430:
------------------------------

    Attachment: OPENJPA-430.patch

A patch that adds this feature.

Switch on using property removeHungarianNotation=true



> 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
>         Attachments: 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.