1) How many columns do I need in MySQL database to store java.time.ZonedDateTime?
2) DATETIME vs TIMESTAMP MySQL types - what is better to store ZonedDateTime and LocalDateTime
Based on this article PersistentDateTimeTZ is used to store joda DateTime in 2 columns. So I expect to have the same for But when I try to use
@Columns(columns={@Column(name="transaction_date"),@Column(name="transaction_date_tz")})
@Type(type = "org.jadira.usertype.dateandtime.threeten.PersistentZonedDateTime")
private ZonedDateTime transactionDate;
I get exception:
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)
P.S.
hibernate-version 4.2.7.Final
jadira-version 4.0.0.GA