You can download the code for this example here:
OnyxDevTools/onyx-database-examples/querying/LazyQueryExample.
Onyx Database supports lazy retrieval of entities using the executeLazyQuery method. Calling this method will return a list with record references rather than the entire entity.
The references are then used to hydrate the results when referenced through the List#get method.
This is helpful when implementing infinite scrolling or reducing the packet size and memory footprint when displaying a list of results or retrieving a parent entity with
an enormous child collection that has FetchPolicy.LAZY.
See Fetch Policy for more information.
If you are using Android or JavaFx, you can easily bind the LazyQueryCollection to a grid view.
This tutorial demonstrates how to lazily query for data in Onyx Database.
As an example, we will execute a lazy query to fetch a list of all "Player" entity references, and then hydrate them one by one.
To see how the data was seeded for this example, see Main.java.
This example uses one of the many constructors that are available.
This will retrieve a LazyQueryCollection which extends the List interface.
Our goal is to bring about change by enabling people to use simple and quality software in order to make sad engineers happy.
Copyright ©2017 Onyx Development Tools, LLC. All rights reserved.