rzo1 opened a new pull request, #304: URL: https://github.com/apache/openjpa/pull/304
[OPENJPA-3076](https://issues.apache.org/jira/browse/OPENJPA-3076): whether a reserved word is delimited was decided by one IdentifierRule that all dictionaries of the JVM share. `MySQLDictionary` (and `MariaDBDictionary` since OPENJPA-3074) switched delimiting on, every other dictionary reset it, so with persistence units for different databases in one JVM the dictionary configured last decided the names for all of them (after a Derby unit, MySQL's `Window` table became `WINDOW0`; after a MariaDB unit, Derby's `Rank` became a case-sensitive `"Rank"`). **Builds on #302 (OPENJPA-3074)**, so the base of this PR is the `OPENJPA-3074` branch; it will be retargeted to master once #302 is merged. **Change:** the shared rule no longer carries database-specific reserved words. Each dictionary decides itself whether a reserved word in a name is delimited (`DBDictionary.normalize`), and the places that create names from mapping metadata, configuration (`openjpa.jdbc.Schema`, the persistence-unit default schema, given table names), schema files (`XMLSchemaParser`) and database metadata go through the dictionary of their configuration. Names written without delimiters, such as the names the database metadata is asked for, are not delimited. A dictionary that delimits reserved words caches the names it gave, so name conversion on MySQL/MariaDB is not slower than before (microbenchmark of `toDBName`: base about 110-134 ns, now about 80-117 ns; Derby unchanged). No public signature changes. The test workaround that reset the shared rule after each test (added on OPENJPA-3074) is removed. **No behaviour change for a single persistence unit:** a new test utility records the generated names (tables, columns, join tables and columns, sequences, indexes, constraints, delimited and mixed-case names, configured schemas, metadata lookups) for a broad set of entities per dictionary. For each of 17 setups (Derby, PostgreSQL, MySQL, MariaDB, Oracle, SQL Server, H2, HSQLDB, DB2, with and without a configured schema) the names of each dictionary alone are identical before and after; with several dictionaries configured one after another, interleaved, in reverse order or on different threads at the same time, each gets the names it gets alone. Hence no compatibility flag; the migration considerations now describe the per-dictionary behaviour instead of the limitation. **Tests:** `TestNamesPerDictionary` (name dump, two configurations in one JVM, concurrent mapping), `TestXMLSchemaParserNames`, `TestNewTableSchemaName`, normalization unit tests. `openjpa-jdbc` unit tests and checkstyle pass; the full `openjpa-persistence-jdbc` suite passes on Derby (4,142 tests); dynamicschema, delimited identifiers, jdbc/sql and schema tests pass on MySQL 8.4, MariaDB 12.3 and PostgreSQL 18. The TCK passed locally on Derby, PostgreSQL, MySQL 8.4 and MariaDB 12.3 (2135 tests, 0 failures each). CI: the TCK and Databases workflows were started on this branch (they also cover Oracle and SQL Server); this PR stays a draft until both pass. -- 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]
