RE: Upcast problems w/SQLServerMergerFactory and AutoAdapter

From: Scott Anderson (
Date: Thu Sep 25 2008 - 13:00:33 EDT

  • Next message: Scott Anderson: "RE: Problems with MS SQL Server and creating merger tokens"

    That method is defined in the DbAdapter interface; you don't need to cast it. See MySQLMergerFactory (post CAY-1108 patch) for an example.

    -----Original Message-----
    From: [] On Behalf Of Řyvind Harboe
    Sent: Thursday, September 25, 2008 3:55 AM
    Subject: Upcast problems w/SQLServerMergerFactory and AutoAdapter

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


    2. This happens when I execute the code below:


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

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

            return new SetNotNullToDb(entity, column) {

                public List<String> createSql(DbAdapter adapter) {
                    StringBuffer sqlBuffer = new StringBuffer();

                    sqlBuffer.append("ALTER TABLE ");
                    sqlBuffer.append(" ALTER COLUMN ");

                    SQLServerAdapter sqladapter = (SQLServerAdapter) adapter;
                    sqladapter.createTableAppendColumn(sqlBuffer, column);

                    return Collections.singletonList(sqlBuffer.toString());


    Řyvind Harboe
    ARM7 ARM9 XScale Cortex
    JTAG debugger and flash programmer

    This archive was generated by hypermail 2.0.0 : Thu Sep 25 2008 - 13:01:13 EDT