Onyx Database: List Tutorial

You can download the code for this example here:

OnyxDevTools/onyx-database-examples/querying/ListExample.

The quickest way to retrieve a list of entities is to use the list method. This tutorial demonstrates how retrieve a list of entities. For this example we will retrieve a list of "Player" entities. To see how the data was seeded for this example, see Main.java.

  1. Get an Instance of the PersistenceManager.
  2. Invoke the PersistenceManager#list method

    This will retrieve a list of entities of a given type

    Notes:
    The list method supports the following arguments:
    The class type of the entities you are requesting
    If you do not pass in a QueryCriteria, the entire collection will be returned.
  3. Now, lets print out the names of all the players in the database.
  4. Make sure to close the factory when you are done with it.
  5. Query