You can configure a time-based database update using XML for a local or distributed eXtreme Scale configuration. You can also configure a local configuration programmatically.
The following example shows an objectgrid.xml file that contains a timeBasedDBUpdate configuration:
JPA time-based updater - XML example
<?xml version="1.0" encoding="UTF-8"?>
<objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"
xmlns="http://ibm.com/ws/objectgrid/config">
<objectGrids>
<objectGrid name="changeOG"
entityMetadataXMLFile="userEMD.xml">
<backingMap name="user" >
<timeBasedDBUpdate timestampField="rowChgTs"
persistenceUnitName="userderby"
entityClass="com.test.UserClass"
mode="INVALIDATE_ONLY"
/>
</backingMap>
</objectGrid>
</objectGrids>
<backingMapPluginCollections>
</objectGridConfig>
In this example, the map "user" is configured with time-based database update. The database update mode is INVALIDATE_ONLY, and the timestamp field is rowChgTs.
When the distributed ObjectGrid "changeOG" is started in the container server, a time-based database update thread is automatically started in partition 0.
If you create a local ObjectGrid, you can also create a TimeBasedDBUpdateConfig object and set it on the BackingMap instance:
public void setTimeBasedDBUpdateConfig(TimeBasedDBUpdateConfig dbUpdateConfig);
For
more information about setting an object on the BackingMap instance,
see BackingMap interfaceAlternatively, you can annotate the timestamp field in the entity class using the com.ibm.websphere.objectgrid.jpa.dbupdate.annotation.Timestamp annotation. By configuring the value in the class, you do not have to configure the timestampField in the XML configuration.