Title: ObjectContext Memory Management
Since Cayenne 3.0, by default DataContext uses weak references to store registered objects. So objects are allowed to be garbage collected by the VM if they are not referenced elsewhere in the application. "Elsewhere" usually means one of the following:
In some cases automatic cleaning of registered objects may result in extra DB trips later on. Depending on a situation, this may or may not be critical, so users will need to weigh the choices of fewer queries vs. smaller memory footprint. In addition to the "dirty objects" scenario described above (and taken care by Cayenne behind the scenes), here are a few more scenarios where a user may choose a different strategy:
To ensure that weak references are not used, create a DataContext manually, passing a regular HashMap to the ObjectStore constructor.
TODO: an example, and figure out how to make it a parameter in the Modeler