|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Target(value={FIELD,METHOD}) @Retention(value=RUNTIME) public @interface CreatedTimestamp
For a timestamp property that is set to the datetime when the entity is created/inserted.
An alternative to using this annotation would be to use insertable=false, updateable=false with @Column and have the DB insert the current time (default value on the DB column is SYSTIME etc).
The downside to this approach is that the inserted entity does not have the timestamp value after the insert has occurred. You need to fetch the entity back to get the inserted timestamp if you want to used it.
@Column(insertable = false, updateable = false) Timestamp cretimestamp;
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |