persistence icon indicating copy to clipboard operation
persistence copied to clipboard

@Version Support for Temporal Types

Open lukasj opened this issue 10 years ago • 5 comments

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

lukasj avatar May 22 '14 15:05 lukasj

  • Issue Imported From: https://github.com/javaee/jpa-spec/issues/81
  • Original Issue Raised By:@glassfishrobot
  • Original Issue Assigned To: Unassigned

lukasj avatar Aug 31 '18 16:08 lukasj

@glassfishrobot Commented Reported by shelleyb

lukasj avatar May 22 '14 15:05 lukasj

@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

lukasj avatar May 22 '14 15:05 lukasj

@glassfishrobot Commented This issue was imported from java.net JIRA JPA_SPEC-81

lukasj avatar May 05 '17 06:05 lukasj

FWIW java.time.Instant would be a much more useful addition here.

andyjefferson avatar Jul 06 '20 10:07 andyjefferson

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.

gavinking avatar Aug 10 '23 23:08 gavinking