Jsondb / jsondb-core

JsonDB a pure java database that stores its data as Json Files
http://www.jsondb.io
MIT License
212 stars 45 forks source link

LocalDateTime cannot be persisted #13

Closed ruromero closed 5 years ago

ruromero commented 6 years ago

Hi,

Is there any way to persist java.time.LocalDateTime? I understand that the problem lays in the lack of a default constructor during the deepCopy phase.

java.lang.InstantiationException: java.time.LocalDateTime
Continuing ...
java.lang.RuntimeException: failed to evaluate: <unbound>=Class.new();

Thanks

FarooqKhan commented 6 years ago

Maybe i need to support AttributeConverter like functionality as described here for JPA: https://www.thoughts-on-java.org/persist-localdate-localdatetime-jpa/

FarooqKhan commented 6 years ago

I wish i had to time to implement this, If someone can implement this i will be glad to review and include it

jansoren commented 5 years ago

Hi,

Could this issue be solved with jackson-modules-java8?


ObjectMapper mapper = new ObjectMapper()
   .registerModule(new ParameterNamesModule())
   .registerModule(new Jdk8Module())
   .registerModule(new JavaTimeModule()); // new module, NOT JSR310Module