Issue #2564: JPA 2.2 LocalDate still not working

Type: Feature requestVersion: 2.8.3Priority: NormalStatus: FixedReplies: 4
#1

Hello, I would have commented in this Thread but somehow I wasn't able to.

Now again 2 years later and objectdb still does not support LocalDate?

com.objectdb.o._RollbackException: Failed to commit transaction: Attempt to store an instance of a non persistable type java.time.LocalDate

or am I doing something wrong?

Also Converters are still not working...

#2

The system blocks posting to very old threads by users that didn't write anything in these threads, due to an habit of some users to prefer adding to old threads rather then creating a new threads, even when the new post is unrelated (although, this is obviously not the case here).

Anyway, there were some technical challenges with supporting all the Java 8 date and time fields. They are currently supported only if you enable serialization, but this is not recommended. We will try to see if at least a partial support (e.g. for LocalDate, and not all the Java 8 date and time types) can be added soon.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

ObjectDB version 2.8.3 supports fields of types:
LocalDate, LocalTime, LocalDateTime, OffsetTime, OffsetDateTime.

Known limitations:

  1. A persistent field that contains a value of these types should be declared using this type, e.g. as LocalDate, or List<LocalDate>, but not as Object. Otherwise, on retrieval a Date instance may be instantiated.
  2. Currently selecting such a field in the query SELECT clause (rather than retrieving full entities) returns equivalent Date instances.
  3.  OffsetTime and OffsetDateTime are converted and stored as UTC.
ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#4

Thank you for the information.

Tested it and it is working.

The limitations don't concern me at the moment but for comprehension reasons:

  1. Why would someone want to store an entity as Object instead of using the right type? Is there a speciali use case for this?
  2. If I understand this right, it means that if the whole entity, which contains a LocalDate field, is queried the field will be a LocalDate, but if just the field is queried directly in the SELECT a Date is returned, right?

Thank you.

#5

> Why would someone want to store an entity as Object instead of using the right type? Is there a speciali use case for this?

This is indeed unusual in Java, but may be more relevant to JVM dynamic type languages.

> If I understand this right, it means that if the whole entity, which contains a LocalDate field, is queried the field will be a LocalDate, but if just the field is queried directly in the SELECT a Date is returned, right?

Yes. This is a temporary limitation, which will probably be fixed in future versions.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login