You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Jeremy Bauer (JIRA)" <ji...@apache.org> on 2012/04/27 17:46:51 UTC

[jira] [Created] (OPENJPA-2182) DB dictionaries do not properly process reserved words for column names

Jeremy Bauer created OPENJPA-2182:
-------------------------------------

             Summary: DB dictionaries do not properly process reserved words for column names
                 Key: OPENJPA-2182
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2182
             Project: OpenJPA
          Issue Type: Bug
          Components: jdbc
    Affects Versions: 2.3.0
         Environment: Sybase, SQL Server
            Reporter: Jeremy Bauer


OpenJPA maintains a set of SQL reserved words in the file sql-keywords.rsrc.  In addition to the reserved words in this file, each db dictionary can append its own set of reserved words.  In addition, each dictionary maintains a set of values that are considered invalid column names.  It uses this set to avoid the use of these names during mapping.   I recently discovered that the Sybase and SQLServer dictionaries are not populating the invalid column names set with the SQL reserved words.  Only the dictionary specific names are being added.  The invalid column words set is being populated when the DB dictionary is constructed.  That occurs before the SQL reserved words are loaded by DBDictionary.endConfiguration().  Thus, the SQL reserved words are not added.

I discovered this issue when using the field name "level" in one of my entities.  This caused a build failure on Sybase.  However, the AbstractSQLServerDictionary contains the same (flawed) logic as Sybase and it did not flag "level" as a keyword.  This says that we can't blindly add all the SQL keywords in sql-keywords.rsrc to the invalid columns list as the logic suggests.  For now, I'm just fixing the testcase to avoid this condition.  I fear that making a code change without extensive testing will cause regression for those happily running on the affected platforms.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira