date - Telosys Timestamp Generation Date problem (missing nanosecond precision)
问题描述
Telosys generates timestamp columns like that:
@Temporal(TemporalType.TIMESTAMP)
@Column(name="AKT_TS")
private Date aktTs;
Unfortunately Date does only have millisecond precision, not nanosecond (but the DB has of course). Example:
- Date (Java): 2020-12-03T16:28:58.302+0000
- DB: 2020-12-03 17:28:58.302339
Is there an easy way to force telosys to generate LocalDateTime (or java.sql.Timestamp), so that the whole precision can be used?
解决方案
In the model entity file use the 'timestamp' type with '@SqlType'
'@SqlType' switches to 'java.sql.*' types (Time, Timestamp, Blob, etc) if possible
Example :
Entity file :
fieldName : timestamp { @SqlType } ;
Generated code :
@Column(name="fieldName")
private Timestamp fieldName ;
推荐阅读
- typescript - 为什么 Typescript 动态元组类型显示自动完成/智能感知中的所有选项?
- java - 为什么我的代码在请求用户输入时会跳到 else 语句?
- sql - 如何在 Snowflake SQL 中同时聚合并取一列的最后一个值?
- css - 如何使用变换原点让 svg 元素从中心旋转?
- node.js - 返回错误:查询返回超过 10000 个结果
- javascript - 我的 javascript 无法读取带有 innerText 的 php 数据库 $row 插入的属性
- android - 如果我在 Jetpack Compose 中配置导航,如何设置顶部应用栏
- android - AndroidX 迁移后,ListView 未在 OnCreate/OnStart 上显示任何数据
- python - Python 术语:接口与协议
- python - 如何将项目附加到班级的列表中?