Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2182

DB dictionaries do not properly process reserved words for column names

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.0
    • 3.2.0
    • jdbc
    • None
    • Sybase, SQL Server

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              struberg Mark Struberg
              techhusky Jeremy Bauer
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: