Upcast problems w/SQLServerMergerFactory and AutoAdapter

From: Øyvind Harboe (oyvind.harbo..ylin.com)
Date: Thu Sep 25 2008 - 03:55:18 EDT

  • Next message: Tore Halset: "Re: Problems with MS SQL Server and creating merger tokens"

    1. I'm getting the exception below in my code:

    org.apache.cayenne.dba.sqlserver.SQLServerMergerFactory$4.createSql(SQLServerMergerFactory.java:108)

    2. This happens when I execute the code below:

    t.createSql(mergerContext.getAdapter());

    3. If #2 is legal, then I don't understand how an upcast to DbAdapter
    to SQLServerAdapter
    can work for AutoAdapter

     ..verride
        public MergerToken createSetNotNullToDb(DbEntity entity, final
    DbAttribute column) {

            return new SetNotNullToDb(entity, column) {

               ..verride
                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());
                }

            };
        }

    -- 
    Øyvind Harboe
    http://www.zylin.com/zy1000.html
    ARM7 ARM9 XScale Cortex
    JTAG debugger and flash programmer
    



    This archive was generated by hypermail 2.0.0 : Thu Sep 25 2008 - 03:56:05 EDT