Onyx Database: Batch Persisting Multiple Entities Tutorial

You can download the code for this example here:
OnyxDevTools/onyx-database-samples/persisting-data ... BatchSavingDataExample.java.

In cases where you need to optimize the save performance for batch insertion or batch updating, you may want to utilize the batch persistence operation provided by Onyx Database Persistence Manager.

  1. Get an instance of an Entity Persistence Manager via the Persistence Manager Factory
  2. Create a loop that will instantiate managed objects and add them to a List.
    Notes:
    All entities within the list must be of the same type.
  3. Invoke the PersistenceManager#saveEntities method to save a Java List.
    Notes:
    Onyx does not differentiate between updating or inserting managed com.onyxdevtools.entities. If an entity with a matching primary key already exists, Onyx will assume you are updating the entity specified and overwrite the existing record.
  4. Execute a Query to verify that your entities were saved.
  5. Deleting An Entity