1)MySQL数据库中需要多少列才能存储java.time.ZonedDateTime?2)DATETIME与TIMESTAMP MySQL类型 – 最好存储ZonedDateTime和LocalDateTime基于此article PersistentDateTimeTZ用于将joda DateTime存储在2列中.所以...

1)MySQL数据库中需要多少列才能存储java.time.ZonedDateTime?
2)DATETIME与TIMESTAMP MySQL类型 – 最好存储ZonedDateTime和LocalDateTime
基于此article PersistentDateTimeTZ用于将joda DateTime存储在2列中.所以我希望有相同的但是当我尝试使用时
@Columns(columns={@Column(name="transaction_date"),@Column(name="transaction_date_tz")})
@Type(type = "org.jadira.usertype.dateandtime.threeten.PersistentZonedDateTime")
private ZonedDateTime transactionDate;
我得到例外:
Caused by: org.hibernate.MappingException: property mapping has wrong number of columns: my.package.Transaction.transactionDate type: org.jadira.usertype.dateandtime.threeten.PersistentZonedDateTime
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:484)
at org.hibernate.mapping.RootClass.validate(RootClass.java:270)
附:
hibernate-version 4.2.7.Final
jadira-version 4.0.0.GA
解决方法:
这是一个小小的怪物.刚刚使用Grails3.
织梦狗教程
本文标题为:用于java.time.ZonedDateTime的MySQL类型


基础教程推荐
猜你喜欢
- Java设计模式之模板方法详解 2023-03-20
- SpringBoot web静态资源映射实现步骤详解 2023-05-14
- Spring的@Value注入复杂类型(通过@value注入自定义类型) 2023-08-11
- SpringCloud eureka(server)微服务集群搭建过程 2023-02-10
- Spring获取ApplicationContext对象工具类的实现方法 2023-07-30
- Java超详细分析@Autowired原理 2023-01-29
- SpringBoot配置文件中密码属性加密的实现 2023-03-11
- Springcloud中的Nacos Config服务配置流程分析 2023-05-18
- Java C++题解leetcode字符串轮转KMP算法详解 2023-06-02
- spring mvc rest 接口选择性加密解密详情 2023-03-20