如何使用 ORM Lite 保留 Java8 LocalDate / LocalDateTime?

How to persist Java8 LocalDate / LocalDateTime with ORM Lite?

如何使用 ORMLite 持久化和恢复属性中包含 LocalDate 或 LocalDateTime 的对象?

How to persist and recover objects with LocalDate or LocalDateTime in it's attributes, using ORMLite?

我会使用 CustomPersister,它允许您定义您的字段在不是 "standard" java 字段时应如何保留。

@DatabaseField(persisterClass = LocalDateTimePersister.class)
private LocalDateTime dateTime;

你应该看看 DateTimeType class 保留 JodaTime DateTime 作为如何编写它们的示例。