[ 
https://issues.apache.org/cayenne/browse/CAY-1117?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tore Halset closed CAY-1117.
----------------------------

    Assignee: Tore Halset  (was: Andrus Adamchik)

> Class Cast Exception in SQLServerMergerFactory from AutoAdapter to 
> SQLServerAdapter
> -----------------------------------------------------------------------------------
>
>                 Key: CAY-1117
>                 URL: https://issues.apache.org/cayenne/browse/CAY-1117
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Cayenne Core Library
>    Affects Versions: 2.0 [STABLE]
>         Environment: Windows XP, 1.6.0_07 by Sun Microsystems Inc., Microsoft 
> SQL Server
>            Reporter: Laurentiu Cocanu
>            Assignee: Tore Halset
>             Fix For: 3.0
>
>
> In 
> cayenne/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlserver/SQLServerMergerFactory.java,
>  the following method
>   @Override
>     public MergerToken createSetNotNullToDb(DbEntity entity, final
> DbAttribute column) {
>         return new SetNotNullToDb(entity, column) {
>             @Override
>             public List<String> createSql(DbAdapter adapter) {
>                 StringBuffer sqlBuffer = new StringBuffer();
>                 sqlBuffer.append("ALTER TABLE ");
>                 sqlBuffer.append(getEntity().getFullyQualifiedName());
>                 sqlBuffer.append(" ALTER COLUMN ");
>                 SQLServerAdapter sqladapter = (SQLServerAdapter) adapter;
>                 sqladapter.createTableAppendColumn(sqlBuffer, column);
>                 return Collections.singletonList(sqlBuffer.toString());
>             }
>         };
>     } 
> the cast SQLServerAdapter sqladapter = (SQLServerAdapter) adapter; will raise 
> a Class Cast Exception.
> A possible fix could be eliminating this cast as createTableAppendColumn 
> method is defined in DbAdapter interface, so the cast is useless.
> See 
> http://www.nabble.com/Upcast-problems-w-SQLServerMergerFactory-and-AutoAdapter-td19664724.html
>  (the patch is known but not implemented yet)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to