Add change listeners to a query and automatically retrieve real-time query updates. When registering a Query Change Listener you can know when your object graph has been updated and use it to indicate when to refresh your UI without having to execute another query.
You can download the code for this example here:
Query Change Listeners are registered automatically when invoking either the executeQuery or executeLazyQuery API methods within the Persistence Manager API.
Whenever using a listener pattern it is always a good idea to clean up listeners in order to prevent bugs and optimize performance.
Our goal is to bring about change by enabling people to use simple and quality software in order to make sad engineers happy.