Re: error committing new created object

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Jan 05 2006 - 05:45:56 EST

  • Next message: Lothar Krenzien: "Re: error committing new created object"

    BTW, to clear the confusion, I added driver auto-detection on
    SQLServer per CAY-374. Also see a SQLServer note in the bottom of
    this wiki page:

    http://objectstyle.org/confluence/display/CAY/Generated+Columns

    This code will be released in M10.

    Andrus

    On Jan 5, 2006, at 4:49 AM, Andrus Adamchik wrote:

    >
    > On Jan 4, 2006, at 11:53 AM, Lothar Krenzien wrote:
    >
    >> Caused by: java.lang.AbstractMethodError:
    >> com.microsoft.jdbc.sqlserver.SQLServerConnection.prepareStatement
    >> (Ljava/lang/String;I)Ljava/sql/PreparedStatement;
    >
    > Generated keys support on MS SQLServer is very confusing as I've
    > mentioned in other threads. In your case the problem is that MS
    > driver does not support this feature, hence the exception.
    >
    > My suggestion is to (a) manually configure adapter on startup to
    > suppress the use of JDBC API for generated keys (see the code
    > below) and (b) leave PK mapped as "generated" to avoid another
    > problem described here:
    >
    > http://objectstyle.org/cayenne/lists/cayenne-user/2006/01/0038.html
    >
    > Here is the code:
    >
    > DataDomain domain = Configuration.getSharedConfiguration().getDomain
    > ();
    > DataMap map = domain.getEntityResolver().lookupObjEntity
    > (TblImportAlert.class).getDataMap();
    > DataNode node = domain.lookupDataNode(map);
    > JdbcAdapter adapter = (JdbcAdapter) node.getAdapter();
    > adapter.setSupportsGeneratedKeys(false);
    >
    >
    > ... or switch to jTDS driver that supports generated keys on SQL
    > Server:
    >
    > http://jtds.sourceforge.net/
    >
    > Andrus
    >



    This archive was generated by hypermail 2.0.0 : Thu Jan 05 2006 - 05:45:59 EST