You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Michael Dick (JIRA)" <ji...@apache.org> on 2008/02/29 23:09:54 UTC

[jira] Created: (OPENJPA-528) FK columns which contain reserved workds are renamed incorrectly.

FK columns which contain reserved workds are renamed incorrectly.
-----------------------------------------------------------------

                 Key: OPENJPA-528
                 URL: https://issues.apache.org/jira/browse/OPENJPA-528
             Project: OpenJPA
          Issue Type: Bug
            Reporter: Michael Dick


The check for reserved words in FK column names happens before we append the _ID suffixes. As a result if a reserved word is found  we end up appending a number to the reserved word and then appending _ID. 

Whats worse is that the check for uniqueness also occurs before we append the _ID, which could lead to other problems down the road.

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


Re: [jira] Assigned: (OPENJPA-528) FK columns which contain reserved workds are renamed incorrectly.

Posted by Michael Dick <mi...@gmail.com>.
You might be right. I think that would help with OPENJPA-430 as well.

The problem I'm running into happens when we resolve the mappings for the
same field more than once. The first time we generate the column name (ex:
ID) and populate our internal table structure correctly. The next time we go
through the mapping we detect that there already is a column named ID and
generate a new unique name ID1.

What's weird is that none of our unit tests hit the problem and it only
happens to one Entity in the test bucket.

-Mike

On Wed, Mar 5, 2008 at 5:23 PM, Patrick Linskey <pl...@gmail.com> wrote:

> If we're going to invest time in this arena, I think it'd be better to
> just look into changing our algorithms to properly escape reserved
> words.
>
> -Patrick
>
> On Sun, Mar 2, 2008 at 1:30 PM, Michael Dick (JIRA) <ji...@apache.org>
> wrote:
> >
> >      [
> https://issues.apache.org/jira/browse/OPENJPA-528?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
> >
> >  Michael Dick reassigned OPENJPA-528:
> >  ------------------------------------
> >
> >     Assignee: Michael Dick
> >
> >  > FK columns which contain reserved workds are renamed incorrectly.
> >  > -----------------------------------------------------------------
> >  >
> >  >                 Key: OPENJPA-528
> >  >                 URL:
> https://issues.apache.org/jira/browse/OPENJPA-528
> >  >             Project: OpenJPA
> >  >          Issue Type: Bug
> >  >            Reporter: Michael Dick
> >  >            Assignee: Michael Dick
> >  >
> >  > The check for reserved words in FK column names happens before we
> append the _ID suffixes. As a result if a reserved word is found  we end up
> appending a number to the reserved word and then appending _ID.
> >  > Whats worse is that the check for uniqueness also occurs before we
> append the _ID, which could lead to other problems down the road.
> >
> >  --
> >  This message is automatically generated by JIRA.
> >  -
> >  You can reply to this email to add a comment to the issue online.
> >
> >
>
>
>
> --
> Patrick Linskey
> 202 669 5907
>

Re: [jira] Assigned: (OPENJPA-528) FK columns which contain reserved workds are renamed incorrectly.

Posted by Patrick Linskey <pl...@gmail.com>.
If we're going to invest time in this arena, I think it'd be better to
just look into changing our algorithms to properly escape reserved
words.

-Patrick

On Sun, Mar 2, 2008 at 1:30 PM, Michael Dick (JIRA) <ji...@apache.org> wrote:
>
>      [ https://issues.apache.org/jira/browse/OPENJPA-528?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
>  Michael Dick reassigned OPENJPA-528:
>  ------------------------------------
>
>     Assignee: Michael Dick
>
>  > FK columns which contain reserved workds are renamed incorrectly.
>  > -----------------------------------------------------------------
>  >
>  >                 Key: OPENJPA-528
>  >                 URL: https://issues.apache.org/jira/browse/OPENJPA-528
>  >             Project: OpenJPA
>  >          Issue Type: Bug
>  >            Reporter: Michael Dick
>  >            Assignee: Michael Dick
>  >
>  > The check for reserved words in FK column names happens before we append the _ID suffixes. As a result if a reserved word is found  we end up appending a number to the reserved word and then appending _ID.
>  > Whats worse is that the check for uniqueness also occurs before we append the _ID, which could lead to other problems down the road.
>
>  --
>  This message is automatically generated by JIRA.
>  -
>  You can reply to this email to add a comment to the issue online.
>
>



-- 
Patrick Linskey
202 669 5907

[jira] Updated: (OPENJPA-528) FK columns which contain reserved workds are renamed incorrectly.

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

Jeremy Bauer updated OPENJPA-528:
---------------------------------

    Attachment: OPENJPA-528.patch

Attachment

> FK columns which contain reserved workds are renamed incorrectly.
> -----------------------------------------------------------------
>
>                 Key: OPENJPA-528
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-528
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: Michael Dick
>            Assignee: Michael Dick
>         Attachments: OPENJPA-528.patch
>
>
> The check for reserved words in FK column names happens before we append the _ID suffixes. As a result if a reserved word is found  we end up appending a number to the reserved word and then appending _ID. 
> Whats worse is that the check for uniqueness also occurs before we append the _ID, which could lead to other problems down the road.

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


[jira] Commented: (OPENJPA-528) FK columns which contain reserved workds are renamed incorrectly.

Posted by "Jeremy Bauer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-528?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12580516#action_12580516 ] 

Jeremy Bauer commented on OPENJPA-528:
--------------------------------------

The original fix provided by Michael has been enhanced to eliminate the problems encountered in the TCK.

In short, when schema mapping occurs columns are inserted into a table object, including foreign key columns.  Then, when foreign keys are mapped into the same table the column name validator finds the column already exists and generates a new unique column with a numeric value appended.  This column is mapped to the foreign key.  Later, when the entity is persisted, the extra/incorrectly generated column name is not found in the database table.  The result is a SQLException.

To eliminate this problem, a new method was added to the DBDictionary to enable/disable the column name uniqueness check.  The method to populate the foreign key column was changed to disable uniqueness checking - since the FK column is already in the table.  Thus, an extra/incorrect column does not get generated.

A patch is provided as OPENJPA-528.patch.  Please review by tomorrow morning (3/20/08).

> FK columns which contain reserved workds are renamed incorrectly.
> -----------------------------------------------------------------
>
>                 Key: OPENJPA-528
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-528
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: Michael Dick
>            Assignee: Michael Dick
>
> The check for reserved words in FK column names happens before we append the _ID suffixes. As a result if a reserved word is found  we end up appending a number to the reserved word and then appending _ID. 
> Whats worse is that the check for uniqueness also occurs before we append the _ID, which could lead to other problems down the road.

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


[jira] Assigned: (OPENJPA-528) FK columns which contain reserved workds are renamed incorrectly.

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

Michael Dick reassigned OPENJPA-528:
------------------------------------

    Assignee: Michael Dick

> FK columns which contain reserved workds are renamed incorrectly.
> -----------------------------------------------------------------
>
>                 Key: OPENJPA-528
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-528
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: Michael Dick
>            Assignee: Michael Dick
>
> The check for reserved words in FK column names happens before we append the _ID suffixes. As a result if a reserved word is found  we end up appending a number to the reserved word and then appending _ID. 
> Whats worse is that the check for uniqueness also occurs before we append the _ID, which could lead to other problems down the road.

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


[jira] Closed: (OPENJPA-528) FK columns which contain reserved workds are renamed incorrectly.

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

Michael Dick closed OPENJPA-528.
--------------------------------

    Resolution: Fixed

> FK columns which contain reserved workds are renamed incorrectly.
> -----------------------------------------------------------------
>
>                 Key: OPENJPA-528
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-528
>             Project: OpenJPA
>          Issue Type: Bug
>            Reporter: Michael Dick
>            Assignee: Michael Dick
>         Attachments: OPENJPA-528.patch
>
>
> The check for reserved words in FK column names happens before we append the _ID suffixes. As a result if a reserved word is found  we end up appending a number to the reserved word and then appending _ID. 
> Whats worse is that the check for uniqueness also occurs before we append the _ID, which could lead to other problems down the road.

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