AW: AW: mysql date

From: Peter Schröder (Peter.Schroede..reenet-ag.de)
Date: Thu Dec 07 2006 - 05:52:13 EST

  • Next message: Ahmed Mohombe: "Re: create query in modeler"

    thx, works fine!

    -----Ursprüngliche Nachricht-----
    Von: Andrus Adamchik [mailto:andru..bjectstyle.org]
    Gesendet: Donnerstag, 7. Dezember 2006 10:39
    An: cayenne-use..ncubator.apache.org
    Betreff: Re: AW: mysql date

    I could easily reproduce the problem. After that I started poking
    around MySQL forums and found a solution - use "zeroDateTimeBehavior"
    URL parameter, e.g. "jdbc:mysql://localhost/cayenne?
    zeroDateTimeBehavior=convertToNull". Here is a few more relevant links:

    http://forums.mysql.com/read.php?39,43138,43195
    http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-
    configuration-properties.html

    Andrus

    On Dec 7, 2006, at 10:53 AM, Peter Schröder wrote:

    > here is the exception:
    >
    > java.sql.SQLException: Value '0000-00-00' can not be represented as
    > java.sql.Timestamp
    > at com.mysql.jdbc.ResultSet.getNativeTimestamp(ResultSet.java:3848)
    > at com.mysql.jdbc.ResultSet.getTimestampInternal(ResultSet.java:5488)
    > at com.mysql.jdbc.ResultSet.getTimestamp(ResultSet.java:5146)
    > at
    > org.objectstyle.cayenne.access.types.UtilDateType.materializeObject
    > (UtilDateType.java:117)
    > at
    > org.objectstyle.cayenne.access.jdbc.JDBCResultIterator.readDataRow
    > (JDBCResultIterator.java:327)
    > at
    > org.objectstyle.cayenne.access.jdbc.JDBCResultIterator.nextDataRow
    > (JDBCResultIterator.java:181)
    > at org.objectstyle.cayenne.access.jdbc.JDBCResultIterator.dataRows
    > (JDBCResultIterator.java:151)
    > at org.objectstyle.cayenne.access.jdbc.SelectAction.performAction
    > (SelectAction.java:178)
    > at org.objectstyle.cayenne.access.DataNodeQueryAction.runQuery
    > (DataNodeQueryAction.java:95)
    > at org.objectstyle.cayenne.access.DataNode.performQueries
    > (DataNode.java:309)
    > at org.objectstyle.cayenne.access.DataDomainQueryAction.runQuery
    > (DataDomainQueryAction.java:355)
    > at org.objectstyle.cayenne.access.DataDomainQueryAction.access$000
    > (DataDomainQueryAction.java:96)
    > at org.objectstyle.cayenne.access.DataDomainQueryAction$1.transform
    > (DataDomainQueryAction.java:327)
    > at org.objectstyle.cayenne.access.DataDomain.runInTransaction
    > (DataDomain.java:856)
    > at
    > org.objectstyle.cayenne.access.DataDomainQueryAction.runQueryInTransac
    > tion(DataDomainQueryAction.java:324)
    > at org.objectstyle.cayenne.access.DataDomainQueryAction.execute
    > (DataDomainQueryAction.java:145)
    > at org.objectstyle.cayenne.access.DataDomain.onQuery
    > (DataDomain.java:766)
    > at org.objectstyle.cayenne.util.ObjectContextQueryAction.runQuery
    > (ObjectContextQueryAction.java:253)
    > at org.objectstyle.cayenne.access.DataContextQueryAction.execute
    > (DataContextQueryAction.java:90)
    > at org.objectstyle.cayenne.access.DataContext.onQuery
    > (DataContext.java:1422)
    > at org.objectstyle.cayenne.access.DataContext.performQuery
    > (DataContext.java:1411)
    >
    > -----Ursprüngliche Nachricht-----
    > Von: Andrus Adamchik [mailto:andru..bjectstyle.org]
    > Gesendet: Donnerstag, 7. Dezember 2006 09:50
    > An: cayenne-use..ncubator.apache.org
    > Betreff: Re: mysql date
    >
    >
    > On Dec 5, 2006, at 12:36 PM, Peter Schröder wrote:
    >
    >> hi there,
    >>
    >> first of all the bug-tracking link on page http://
    >> incubator.apache.org/cayenne/how-can-i-help.html is broken :-( but
    >> i found it through google.
    >
    > Thanks for pointing it out. I fixed it on the site - it will be
    > published within an hour.
    >
    >> we have a lot of old data stored in our mysql-database. there are
    >> lots of date-fields with date of '0000-00-00 00:00:00' (which
    >> should in deed be 'null') which cause cayenne to fail on fetching
    >> data-objects, cause it cant convert the date: Value '0000-00-00'
    >> can not be represented as java.sql.Timestamp.
    >> do i have to update all these fields to null, so that cayenne can
    >> work properly?
    >
    > What is the exception? I would assume this is thrown at the driver
    > level, not Cayenne, but if you can provide more details, maybe there
    > is a way for us to create a workaround.
    >
    > Andrus
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Dec 07 2006 - 05:52:49 EST