Value '0000-00-00' can not be represented as java.sql.Timestamp
来源:互联网 发布:淘宝网店铺装修实战 编辑:程序博客网 时间:2024/05/22 03:14
使用hibernate开发程序的时候,有的时间字段没有必要填写,但是,以后hibernate查询的时候会报出
“java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp”
的错误, 这是因为hibernate认为这个不是一个有效的时间字串。而有效的日期格式为“ 0001-01-01 00:00:00.0 ”
所以, 我们在jdbc连接出改成:
“jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull”
或者
“jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=round 0001-01-01 00:00:00.0 ”
就解决这个问题了。
- Err:java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
- [DEBUG] “java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp”
- java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp
- “java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Timestamp”
- java Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
- Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
- Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
- ERROR: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
- Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
- 提示Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp;
- Value ‘0000-00-00 00:00:00’ can not be represented as java.sql.Timestamp
- Value '0000-00-00' can not be represented as java.sql.Timestamp
- Value '0000-00-00' can not be represented as java.sql.Timestamp错误
- mysql Value '0000-00-00' can not be represented as java.sql.Timestamp
- mysql抛出Value '0000-00-00' can not be represented as java.sql.Timestamp异常
- hiERROR: Value '0000-00-00' can not be represented as java.sql.Timestamp
- 解决:java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
- java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
- ZOJ 1136 Multiple(BFS)
- 第八周上机项目一(2):用类的友元函数实现运算符的重载
- 数据挖掘十大经典算法
- 汇编学习笔记《一》
- 关于Visual studio2010 和 Microsoft SQL Server 2008 Management Studio Express 的安装
- Value '0000-00-00' can not be represented as java.sql.Timestamp
- (最原始) Balanced Lineup (P3264)
- adpatch OPTIONS
- SQL点滴19—T-SQL中的透视和逆透视
- java中的23中设计模式
- Pivot Tables Tutorial
- 深入了解java自动装箱和拆箱
- 数据挖掘十大经典算法(1) C4.5
- hdu 1853 Cyclic Tour (KM)