Re: Oracle ClassCast Exception

From: Mike Kienenberger (mkienen..laska.net)
Date: Wed Feb 16 2005 - 11:37:02 EST

  • Next message: Joćo Paulo Vasconcellos: "Re: Oracle ClassCast Exception"

    Which version of the Oracle driver are you using?

    One of the big changes from Oracle 8 to 9 was DATE to TIMESTAMP. I'm
    pretty sure that the default Oracle types in the
    org.objectstyle.cayenne.dba.types.xml file are still DATE (they are in
    cvs).

    If you're using a later driver, it might be trying to do things internally
    with TIMESTAMPs instead of DATEs.

    Also, provide the query being logged by Cayenne, and what you're pasting
    into Oracle. Maybe that will shed some light.

    Otherwise, your best bet is to set a breakpoint at
    org.objectstyle.cayenne.access.types.AbstractType.setJdbcObject(AbstractType.java:78)
    and see what jdbc type is being set as well as what field name and value is
    being referenced.

    -Mike

    =?ISO-8859-1?Q?Jo=E3o_Paulo_Vasconcellos?= <vasconcello..mail.com> wrote:
    > Hi list,
    >
    > I am having a problem trying to retrtieve some rows from an Oracle 8i
    > database. I am using Cayenne 1.1 final and DB adapter
    > 'org.objectstyle.cayenne.dba.oracle.OracleAdapter' and jdbc driver
    > 'oracle.jdbc.driver.OracleDriver'.
    >
    > I need to get a row from 2 key columns, trtying to do like that:
    >
    > Map parameters = new HashMap();
    > parameters.put("NUM_MATRICULA", id1);
    > parameters.put("NUM_DEPEN", id2);
    >
    > UsuarioSenhaWeb usw =
    > (UsuarioSenhaWeb) DataObjectUtils.objectForPK(context,
    > UsuarioSenhaWeb.class, parameters);
    >
    > The final query generated by cayenne is correct and return as expected
    > if I copy/paste to oracle, but when I try to do in my application, it
    > gives me stack trace:
    >
    > INFO QueryLogger: *** error.
    > java.lang.ClassCastException
    > at
    oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:2021)
    > at
    oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:2102)
    > at
    org.objectstyle.cayenne.access.types.AbstractType.setJdbcObject(AbstractType.java:78)
    >
    > Anyone has any ideas? I think the Oracle driver is kicking my ass, but
    > not sure. Got the last one from Oracle and still got the problem.
    >
    >
    > Thanks,
    > --
    > Joćo Paulo Vasconcellos
    > ICQ: 123-953-864



    This archive was generated by hypermail 2.0.0 : Wed Feb 16 2005 - 11:36:22 EST