IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

com.ibm.websphere.objectgrid.jpa.dbupdate.annotation
Annotation Type Timestamp


@Target(value=FIELD)
@Retention(value=RUNTIME)
public @interface Timestamp

This annotation specifies the timestamp field of an entity class that serves for the time-based update purpose. The Timestamp value is used to identify the time or sequence when a database backend record was last updated.

In some scenarios, it is important for ObjectGrid to know the backend updates after a certain time, so the data in ObjectGrid can be synchronized with the backend.

Although the annotation indicates it is a time stamp, the field does not have to be a TimeStamp type, nor does its value have to take a time stamp format. It could be a integer, long, or any type as long as it can be compared by ">=" using the Java Persistence API (JPA) query.

For example, in DB2 9.5, you can define a column using the ROW CHANGE TIMESTAMP format as follows:

 ROWCHGTS TIMESTAMP NOT NULL
      GENERATED ALWAYS
      FOR EACH ROW ON UPDATE AS
      ROW CHANGE TIMESTAMP
 

You can then map your entity class attribute to this column using the Column annotation and indicate it to be used by for time-based updates using InvalidationTimestamp annotation.

 @Column (name = "ROWCHGTS", updatable=false)
 @Timestamp
 public Timestamp ts;
 

In Oracle, there is a pseudo-column ora_rowscn for the system change number of the record. You can use this column for the same purpose. For example,

 @Column (name="ora_rowscn", updatable=false)
 @Timestamp
 protected long scn;
 

Only a single Version property or field should be used per class.

Since:
WAS XD 6.1.0.3


IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

© Copyright International Business Machines Corp 2005,2012. All rights reserved.