postgresql - postgresql 获取时间戳列作为 zonedatetime
问题描述
我想TIMESTAMP WITH TIMEZONE
使用 Spring-Boot获取类型的 postgresql 表记录JdbcTemplate
。
ZonedDateTime
在获取时间戳列作为 Java 8 的ie ( queryForObject(myQuery, ZonedDateTime.class)
)时出现以下错误
影响行号 0 和列类型 'timestamptz' 的类型不匹配:
值 [2018-06-26 18:19:31.313733] 的类型为 [java.sql.Timestamp] 并且
无法转换为所需类型 [java.time.ZonedDateTime]
如何解决这个问题?
解决方案
推荐阅读
- jsx - 如何通过扩展脚本访问设置遮罩效果中的图层控件
- c++ - mmap 虚拟内存 (HDD) 和主内存 (RAM) 分配
- javascript - 我如何打开浏览器提示以使用 Web 组件输入来保存密码?
- php - 手动添加订单时预填充 WooCommerce 产品的“添加元”/产品选项
- node.js - 传入的 typescript 参数必须是 12 个字节的单个字符串或 24 个十六进制字符的字符串
- sql - 如何根据“datediff”创建列
- python - 为什么即使设置 sys.setswitchinterval(1000) 也会有多个线程工作
- docker - Docker 与 Apache、PHP 和 Elasticsearch
- javascript - 如何从上下文 API 中的组件调用函数?
- python - 程序有什么问题