persistence
persistence copied to clipboard
@Version Support for Temporal Types
The JPA 2.1 specification currently indicates that Timestamp is the only supported temporal type for @Version properties:
The following types are supported for version properties: int, Integer, short, Short, long, Long, Timestamp.
I'd propose that additional temporal types are supported as well:
java.util.Date, java.util.Calendar, java.sql.Date, java.sql.Time, java.sql.Timestamp
- Issue Imported From: https://github.com/javaee/jpa-spec/issues/81
- Original Issue Raised By:@glassfishrobot
- Original Issue Assigned To: Unassigned
@glassfishrobot Commented Reported by shelleyb
@glassfishrobot Commented shelleyb said: For reference, Hibernate already seems to support this, and as such, we had initially overlooked this jpa limitation and are already using @Version java.util.Calendar in our entities, and I have observed this usage elsewhere as well:
https://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch05.html#mapping-declaration-timestamp
@glassfishrobot Commented This issue was imported from java.net JIRA JPA_SPEC-81
FWIW java.time.Instant would be a much more useful addition here.
In #450 I propose adding LocaDateTime
and Instant
. We don't need to add the other date/time types mentioned above, since they're being deprecated.