FAQ
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


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

};
}

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

Search Discussions

  • Scott Anderson at Sep 25, 2008 at 5:01 pm
    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: oyvindharboe@gmail.com On Behalf Of Øyvind Harboe
    Sent: Thursday, September 25, 2008 3:55 AM
    To: cayenne-user@incubator.apache.org
    Subject: Upcast problems w/SQLServerMergerFactory and AutoAdapter

    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


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

    };
    }

    --
    Øyvind Harboe
    http://www.zylin.com/zy1000.html
    ARM7 ARM9 XScale Cortex
    JTAG debugger and flash programmer
  • Tore Halset at Sep 25, 2008 at 8:57 pm
    Thanks. I removed the cast.

    - Tore.
    On Sep 25, 2008, at 19:00, Scott Anderson wrote:

    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: oyvindharboe@gmail.com On
    Behalf Of Øyvind Harboe
    Sent: Thursday, September 25, 2008 3:55 AM
    To: cayenne-user@incubator.apache.org
    Subject: Upcast problems w/SQLServerMergerFactory and AutoAdapter

    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


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

    };
    }

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedSep 25, '08 at 7:55a
activeSep 25, '08 at 8:57p
posts3
users3
websitecayenne.apache.org

People

Translate

site design / logo © 2022 Grokbase