1



I have a MySQL database connected to my application with the Drizzle MySQL-connector.

This database has a table with a DateTime column that can have the value 0000-00-00 00:00:00.

Now I want to get some data:

TypedQuery<UserData> query = em.createQuery("FROM UserData", UserData.class);
    List<UserData> result = query.getResultList();

This throws the following exception:

org.hibernate.exception.GenericJDBCException: Could not parse column as timestamp, was: "0000-00-00 00:00:00"

With the mysql-connector-java you can convert '0000-00-00 00:00:00' to null the following way in your datasource.xml:

<connection-url>jdbc:mysql://localhost/myDatabase?zeroDateTimeBehavior=convertToNull</connection-url>

The Drizzle Connector doesn't have that connection-option.

Is there any other way to handle this zeroDateTimeBehavior with the Drizzle driver?

klausf
  • 289
  • 2
  • 8

0 Answers0