欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp

程序员文章站 2022-04-21 12:04:29
...

Error querying database. Cause: java.sql.SQLException: Value ‘0000-00-00 00:00:00’ can not be represented as java.sql.Timestamp

解决方案

        <property name="url">
            <value>jdbc:mysql://localhost:3306/test?zeroDateTimeBehavior=convertToNull</value>
        </property>

加上 zeroDateTimeBehavior=convertToNull