You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (Jira)" <ji...@apache.org> on 2026/05/15 23:14:00 UTC
[jira] [Closed] (CAY-2944) MergerTokenFactoryProvider does not resolve adapter subclasses
[ https://issues.apache.org/jira/browse/CAY-2944?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrus Adamchik closed CAY-2944.
--------------------------------
Resolution: Fixed
> MergerTokenFactoryProvider does not resolve adapter subclasses
> --------------------------------------------------------------
>
> Key: CAY-2944
> URL: https://issues.apache.org/jira/browse/CAY-2944
> Project: Cayenne
> Issue Type: Bug
> Reporter: Andrus Adamchik
> Assignee: Andrus Adamchik
> Priority: Minor
> Fix For: 5.0-M2
>
>
> We had this bug like forever. It was exposed by my recent attempt to unwind test suite customizations (namely let the test stack guess its DbAdapter). So...
>
> MergerTokenFactoryProvider.get(DbAdapter) looks up the per-adapter MergerTokenFactory by exact class name. When the underlying adapter is a subclass of a
> mapped adapter, the lookup misses and falls back to DefaultMergerTokenFactory, producing SQL that is invalid for the actual database.
> Example: against HSQLDB 2.x, HSQLDBSniffer returns HSQLDBNoSchemaAdapter (extends HSQLDBAdapter). The factory map only has HSQLDBAdapter, so a column-type
> change emits ALTER ... TYPE VARCHAR(20) instead of HSQL's ALTER COLUMN ... VARCHAR(20). HSQL rejects it, leaving the schema out of sync.
> Fix: Walk up the adapter's class hierarchy when resolving the factory; fall back to the default only if no ancestor matches.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)