WebSphere eXtreme Scale Administration Guide > Configure WebSphere eXtreme Scale > Loaders
Configure a JPA time-based data updater
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.
For more information about how the Java™ Persistence API (JPA) time-based data updater works, see JPA time-based data updater.
Procedure
Create a timeBasedDBUpdate configuration.
- With an XML file:
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.
- Programmatically:
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 BackMap interface
Alternatively, 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.
What to do next
Start the JPA time-based data updater. See Start the JPA time-based updater for more information.
Parent topic
Loaders
Related concepts
Related tasks
Related reference
Write-behind dumper class sample code