[Java programming language only]

Developing client-based JPA loaders

You can implement preloading and reloading of data in your application with a Java Persistence API (JPA) utility. This capability can simplify loading the maps when the queries to the database cannot be partitioned.

Before you begin

About this task

When you run a preload or reload operation on your map, the following actions occur:
  1. The initial action that is taken depends on if you are running a preload or reload operation.
    • Preload operation: The map to be preloaded is cleared. For an entity map, if any relation is configured as cascade-remove, any related maps are cleared.
    • Reload operation: The provided query is run on the map and the results are invalidated. For an entity map, if any relation is configured with the CascadeType.INVALIDATE option, the related entities are also invalidated from their maps.
  2. Run the query to JPA for the entities in a batch.
  3. For each batch, a key list and value list for each partition is built.
  4. For each partition, the data grid agent is called to insert or update the data on the server side directly if it is an eXtreme Scale client. If the data grid is a local instance, the data in the maps is directly inserted or updated.