Persisting attribute using "new" Java time Instant in MySQL


Page bloom
 
Edited

Traditionally we have used the java.util.Date class for storing time instants in UTC time - in all existing tables DN has created a 'TIMESTAMP' type field in MySQL - which works fine.

Recently we added our first attribute of type java.time.Instant (getting all jiggy with the "new" Java time library - better late than never!) and the DN docs say that the default mapping is a TIMESTAMP (via the convention that the bold type is the default):

https://www.datanucleus.org/products/accessplatform/jdo/mapping.html#_temporal_types_java_util_java_sql_java_time_jodatime

Java Type:  java.time.Instant
Comments:     Persisted as TIMESTAMP, String, Long, or DATETIME.

However, the Instant attribute has been mapped to a DATETIME instead of TIMESTAMP.

We have not added any specific customizations to the XML metadata so would assume that it would have mapped to the default TIMESTAMP.

Any idea what me going on? Have I misunderstood the docs? Do we need to explicitly set the MySQL type to TIMESTAMP somehow?

Join main@datanucleus.groups.io to automatically receive all group messages.