J'utilise la classe Java 8 LocalDateTime
pour conserver la date dans le magasin de données. La date est ce format 2017-07-24T01:00:00.000
est persisté comme EmbeddedEntity.objectify.LoadException: java.time.LocalDateTime doit avoir un constructeur no-arg
private LocalDateTime matchDateTime;
Le flux de persistance est correct. Mais quand je charge l'entité, l'exception est levée.
com.googlecode.objectify.LoadException: Error loading : java.time.LocalDateTime must have a no-arg constructor
at com.googlecode.objectify.impl.EntityMetadata.load(EntityMetadata.java:78) ~[objectify-5.1.21.jar:na]
at com.googlecode.objectify.impl.LoadEngine.load(LoadEngine.java:185) ~[objectify-5.1.21.jar:na]
Caused by: java.lang.IllegalStateException: java.time.LocalDateTime must have a no-arg constructor
at com.googlecode.objectify.impl.TypeUtils.getNoArgConstructor(TypeUtils.java:47) ~[objectify-5.1.21.jar:na]
at com.googlecode.objectify.ObjectifyFactory.construct(ObjectifyFactory.java:69) ~[objectify-5.1.21.jar:na]
Caused by: java.lang.NoSuchMethodException: java.time.LocalDateTime.<init>()
at java.lang.Class.getConstructor0(Class.java:3082) ~[na:1.8.0_131]
at java.lang.Class.getDeclaredConstructor(Class.java:2178) ~[na:1.8.0_131]
Comment résoudre ce problème?
J'ai recherché & ajouté dans mon pom.
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-parameter-names</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.8.9</version>
</dependency>
Marqué la propriété date avec
@JsonSerialize(using = ToStringSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime matchDateTime;
mais cela n'a pas d'entraînement. Des suppositions?