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
- fixes
-
OPENJPA-84 Escape sql reserved words in column names
- Closed
- is duplicated by
-
OPENJPA-1303 Reserved words are not mapped correctly in table definition
- Closed