Andrus Adamchik created CAY-2944:
------------------------------------

             Summary: 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
             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)

Reply via email to