rzo1 opened a new pull request, #302:
URL: https://github.com/apache/openjpa/pull/302

   [OPENJPA-3074](https://issues.apache.org/jira/browse/OPENJPA-3074): 
follow-up to the review of #297.
   
   **Builds on #297 (OPENJPA-2943) and #296 (OPENJPA-2935)**, which both change 
the two dictionaries; they are merged into this branch. Until they are merged, 
the diff here contains their commits too; the commits of this PR are the 
`[OPENJPA-3074]` ones. I will rebase once they are in.
   
   **Common superclass.** The code `MySQLDictionary` and `MariaDBDictionary` 
share moves into the new `AbstractMySQLDictionary` (named like 
`AbstractDB2Dictionary` / `AbstractSQLServerDictionary`). The public fields 
stay settable on both classes with the same per-database defaults; a reflection 
dump of every field of both dictionaries, before and after 
`connectedConfiguration`, for 14 server/driver versions was identical before 
and after the refactor. Real differences (version detection, replication 
detection, error handling, word lists) stay in the subclasses.
   
   **Reserved words.** The word lists are taken from the servers 
(`INFORMATION_SCHEMA.KEYWORDS` and an unquoted `CREATE TABLE` per word on MySQL 
8.4 / 9.7 and MariaDB 10.11 / 12.3):
   - MySQL: the words reserved since 8.0 (`RANK`, `ROW_NUMBER`, `WINDOW`, 
`LATERAL`, ...) plus words that were in the invalid column list but not used 
for table names (`NTILE`, `DUAL`, `KEYS`, `LIMIT`, ...).
   - MariaDB: its own reserved words (`OFFSET`, `RETURNING`, `VECTOR`, ...) and 
the built-in function names that MariaDB Connector/J's `IGNORE_SPACE` sql_mode 
rejects as table names.
   - MariaDB now delimits reserved words with back ticks as MySQL does 
(OPENJPA-2940), instead of appending `0`.
   
   **Upgrade:** a table, column, join table or join column named after such a 
word is now delimited instead of renamed (e.g. `RANK0` becomes `` `rank` ``, on 
MariaDB `ORDER0` becomes `` `Order` ``) and keeps the case of the entity or 
attribute name. 
`openjpa.Compatibility=UpdatedMySQLAndMariaDBReservedWords=false` (default 
`true`) restores the names generated before this change. Documented in the 
migration considerations ("Names that MySQL and MariaDB reserve") and in the 
Upgrade Notes of `RELEASE-NOTES.html`.
   
   **Known limitation, not changed here:** whether a name is delimited is 
decided by a JVM-wide identifier rule, so with a MySQL/MariaDB and another 
persistence unit in one JVM the dictionary configured last wins (this was 
already the case on MySQL). Fixing it touches identifier creation in about 215 
places, so it is left for a separate issue; the migration considerations 
mention it.
   
   **Tests:** new `TestAbstractMySQLDictionary` (defaults, plugin properties, 
user subclasses, word sets and names with the flag on and off, names built from 
a delimited name), MySQL version tests in `TestMySQLDictionary`, and 
`TestMySQLReservedWordColumns` (entities `Window`, `Linear`, `Dual`, `Ntile` 
with columns such as `rank`, `offset`, `limit`: DDL, CRUD, JPQL, bulk update).
   - `openjpa-jdbc` unit tests and checkstyle pass.
   - `openjpa-persistence-jdbc` (dynamicschema, delimited identifiers, 
jdbc/sql, schema, JPQL, criteria, query, datacache and the 
MySQL/MariaDB-specific tests, 1455 tests) passes on MySQL 8.4, MySQL 9.7, 
MariaDB 10.11 and MariaDB 12.3.
   - The TCK passed locally on MySQL 8.4 and MariaDB 12.3 (2135 tests, 0 
failures each).
   
   CI: the Databases workflow was started on this branch; this PR stays a draft 
until it passes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to