In a nutshell:
java.time.ZonedDateTime
has no args constructor (actually it has no
constructor at all)- to get over this, I should write a
ZonedDateTimeConverter
for Morphia - if I try to save and load my
ZonedDateTime
without converter, Morphia saves the fullZonedDateTime
object asDBObject
which is cool because I could read all the fields and initiate a ZonedDateTime object from it, but I got an exception on loading:No usable constructor for java.time.ZonedDateTime
- if I try to save and load the
ZonedDateTime
with the converter, I got another exception:Can't find a codec for class java.time.LocalDateTime
. I started to play with the converters, based on this article but without any result. - So if I have no converter I can save but can't load, if I have the converter, I can't even save because of missing codecs.
Any idea?
UPDATE:
Turned out that I should write a converter for each subtype started from ZonedDateTime
(e.g. LocalDateTime
, LocalDate
, LocalTime
), but turned out that I should write a converter for java.time.ZoneRegion
which is package-private.