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

   https://issues.apache.org/jira/browse/OPENJPA-2943
   
   `MySQLDictionary.decorate()` made a connection read-only (so reads go to a 
replica) only for `com.mysql.jdbc.ReplicationDriver`, which Connector/J 8 
removed.
   
   - A replication connection is now recognized by the connection itself: 
Connector/J's `ReplicationConnection` (looked up by name, no compile-time 
dependency), unwrapping OpenJPA's connection decorators, so DataSource and 
pooled connections work too. The configured legacy driver name stays as a 
fallback.
   - Only the store manager's connection is read-only, and only outside a 
transaction; it becomes writable when a transaction begins 
(`DBDictionary.isReplicationConnection(Connection)`). Connections for sequences 
and the schema tool are never read-only. Without this, sequences, DDL, 
bulk/native updates and pessimistic locks failed with "Cannot execute statement 
in a READ ONLY transaction" once detection worked.
   - `MariaDBDictionary` recognizes `jdbc:mariadb:replication:` connections by 
their metadata URL.
   - Documented in the reference guide (database setup).
   
   Unit tests in `TestMySQLDictionary`/`TestMariaDBDictionary` and 
`TestReplicationConnection`; checked against MySQL 9 with Connector/J and a 
`jdbc:mysql:replication://` URL (`TestGeneratedValues`, 
`TestBulkUpdateMultipleTables` pass).
   
   CI: the TCK and Databases workflows were started on this branch; 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]

Reply via email to