When used wisely prefetches can save significant amount of time in ROP. In situation where the server and client are separated over large distance any query takes some time, and in case of faulting few chained relationships we have seen improvements measured in minutes!
Now the problem is that such query result is not always used in the same context as it was fetched. Unfortunately when the localObject is used only the object is copied, loosing all the already faulted related records. Can the localObject accept one more parameter and allow deep merge of the localised tree? Maybe the list of relationships to merge into the new copy can be passed to the locaObject function as a array of String or something? Of course such deep localObject would work only on PersistentState.COMMITTED objects
SelectQuery sq = new SelectQuery(Country.class, someExpression);
//this executes in one SQL query, very fast
List<Country> countries = getCurrentContext().performQuery(sq);
//user is selecting a random city for editing. For safety reasons the object has to be copied out of the original context.
City localisedCity = (City) newContext.localObject(countries.get(3).getCities().get(4).getObjectId(), null);
now the localisedCity has no faulted relatioships. this means that to assemble list of artists for the given city there going to be executed
- RelationshipQuery for galleries
- for each gallery RelatioshipQuery for paintings
- for each painting RelatiohshipQuery for artist
|Field||Original Value||New Value|
|Fix Version/s||Undefined future [ 12313763 ]|
|Component/s||ROP [ 12313235 ]|
|Component/s||Core Library [ 12312714 ]|
|Workflow||jira [ 12464751 ]||Cayenne workflow [ 12487761 ]|