Support for more automatic values besides @GeneratedId (JPA_SPEC-36)

[JPA_SPEC-49] @CurrentTimestamp Created: 23/Feb/13  Updated: 25/Nov/16

Status: Open
Project: jpa-spec
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Sub-task Priority: Major
Reporter: mkarg Assignee: ldemichiel
Resolution: Unresolved Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


New annotation "@CurrentTimestamp" should inject the current timestamp of a transaction into a data field.

The annotation will guarantee that at the transaction start the timestamp is produced once, so all uses of the annotation within the same transaction will guarantee to inject the same timestamp value.

This is another essential business need, as sometimes transactions run rather long, but all written data shall have synchronized timestamps.

Comment by rbygrave [ 24/Nov/16 ]

Personally I'd argue for 2 annotations like @WhenCreated and @WhenUpdate. I've already mentioned this in #48 wrt SQL2011 History support and auditing etc. Just adding this comment here in case ... something happens !!

Comment by neilstockton [ 25/Nov/16 ]

+1 for @CreateTimestamp and @UpdateTimestamp, and with both taking the timestamp at FLUSH. The reason to use flush timestamp is that with updates you may have multiple updates of an object in a transaction, so need to distinguish which update.

Generated at Tue Feb 21 03:44:22 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.