can not be represented as java.sql.Timestamp
来源:互联网 发布:软件开发合同规定 编辑:程序博客网 时间:2024/05/21 11:00
使用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 ”
就解决这个问题了。
0 0
- can not be represented as java.sql.Timestamp
- can not be represented as java.sql.Timestamp
- can not be represented as java.sql.Timestamp
- can not be represented as java.sql.Timestamp
- can not be represented as java.sql.Timestamp
- can not be represented as java.sql.Timestamp
- 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.sql.SQLException: Value '[B@8ea6b9' 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' 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
- Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
- mysql抛出Value '0000-00-00' can not be represented as java.sql.Timestamp异常
- '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp error
- make的那些事
- mysql中的substr()函数
- Web Service 服务安全漫谈
- Ext 中RadioGroup 监听事件 为什么只执行一次
- Extjs之访问store
- can not be represented as java.sql.Timestamp
- 手机号码和电话号码正则表达式
- 【转载】js获取当前日期,格式化成xxxx-xx-xx的格式(根据情况补零)
- SQLYog快捷键大全
- 【面试题】关于指针
- mysql左右关联,内关联
- 流文件 就是没有结构的文件!
- Extjs中datefield监听事件
- Ext布局--fit,border