Problems with OracleAdapter

From: laila paganelli (laila.paganell..mail.com)
Date: Wed Mar 23 2005 - 09:42:55 EST

  • Next message: Cris Daniluk: "RE: Problems with OracleAdapter"

    Hi,

    I would like use an OracleAdapter in my application because I want to
    customize PK generation.
    If I create a dataNode with a DbAdapter
    org.objectstyle.cayenne.dba.JdbcAdapter works very well,
    but if I set DbAdapter
    org.objectstyle.cayenne.dba.oracle.OracleAdapter an error occur.

    INFO 2005-03-23 14:28:04,854 *** error.
    java.sql.SQLException: operation not allowed: streams type cannot be
    used in batching
            at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
            at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
            at oracle.jdbc.driver.OraclePreparedStatement.addBatch(OraclePreparedStatement.java:3999)
            at org.objectstyle.cayenne.access.DataNode.runBatchUpdateAsBatch(DataNode.java:535)
            at org.objectstyle.cayenne.dba.oracle.OracleDataNode.runBatchUpdateAsBatch(OracleDataNode.java:355)
            at org.objectstyle.cayenne.access.DataNode.runBatchUpdate(DataNode.java:498)
            at org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:353)
            at org.objectstyle.cayenne.access.ContextCommit.commit(ContextCommit.java:192)
            at org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:1266)
            at org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:1236)
            [...]

    I'm using a simple ExtendedType implementation for Oracle LONG fields
    (view also http://www.objectstyle.org/cayenne/lists/cayenne-user/2005/01/0193.html)
    with a method

    public void setJdbcObject( java.sql.PreparedStatement st,
                                java.lang.Object val,
                                int pos,
                                int type,
                                int precision) throws java.lang.Exception {
        if (val != null) {
            com.extrapola.cayenne.oracle.LongType longType;
            java.io.StringReader in;
                            
            longType = (com.extrapola.cayenne.oracle.LongType)val;
                            
            in = new java.io.StringReader(longType.string());
            st.setCharacterStream(pos, in, longType.string().length());
        } else {
            super.setJdbcObject(st, val, pos, type, precision);
        }
    }

    Some suggestion?

    Thanks
    Laila



    This archive was generated by hypermail 2.0.0 : Wed Mar 23 2005 - 09:43:04 EST