2 Replies Latest reply on Jun 3, 2005 4:24 PM by schmidts

    oracle Date type and EJBs

      When using oracle 9i and JBoss 3.2.3 and trying to use a ejb create function to create a date I get an error with mysql.

      2005-06-02 16:13:32,510 ERROR [STDERR] java.sql.SQLException: Fail to convert to internal representation
      2005-06-02 16:13:32,510 ERROR [STDERR] at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
      2005-06-02 16:13:32,510 ERROR [STDERR] at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
      2005-06-02 16:13:32,510 ERROR [STDERR] at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
      2005-06-02 16:13:32,510 ERROR [STDERR] at oracle.jdbc.driver.OracleStatement.getLongValue(OracleStatement.java:4367)
      2005-06-02 16:13:32,510 ERROR [STDERR] at oracle.jdbc.driver.OracleResultSetImpl.getLong(OracleResultSetImpl.java:529)
      2005-06-02 16:13:32,510 ERROR [STDERR] at com.snc.distribution.kingservices.KingPackageGeneratorProcess.process(Unknown Source)
      2005-06-02 16:13:32,510 ERROR [STDERR] at com.snc.distribution.kingservices.KingPackageGeneratorProcess.onMessage(Unknown Source)
      2005-06-02 16:13:32,510 ERROR [STDERR] at xflow.client.WorkflowProcess.onMessage(WorkflowProcess.java:103)
      2005-06-02 16:13:32,510 ERROR [STDERR] at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:546)
      2005-06-02 16:13:32,510 ERROR [STDERR] at java.lang.Thread.run(Thread.java:534)
      


      Here is the code that generates this error:

       currentItem = itemHome.create(itemInfo.getString(), itemInfo.getDate().getTime(), "STRING", new Long(3));
      
      


      The itemInfo.getDate() returns a GregorianCalandar. We then get a Date object from that and pass it to the create.

      The oracle table looks like this

      Table items
      NUMBER id
      VARCHAR2(20) name
      DATE theDateModified
      VARCHAR2(250) description
      NUMBER(10) id


      It then blows up with the error above. any ideas what would cause this to happen. I don't want to hardcode it to just oracle because we sometimes use mysql to do development. Any suggestions?