#1658 - ENH: Add label to ProfileLocation and use as default query label

- Extend/propagate the label from the origin query to secondary queries
(appending the relative path).
This commit is contained in:
rob bygrave
2019-03-27 12:57:36 +13:00
parent fc032c632b
commit f8b97ff397
4 changed files with 38 additions and 4 deletions
@@ -3,6 +3,7 @@ package io.ebeaninternal.server.loadcontext;
import io.ebean.FetchConfig;
import io.ebean.bean.ObjectGraphNode;
import io.ebean.bean.PersistenceContext;
import io.ebeaninternal.api.SpiQuery;
import io.ebeaninternal.server.deploy.BeanDescriptor;
import io.ebeaninternal.server.querydefn.OrmQueryProperties;
@@ -77,6 +78,20 @@ public abstract class DLoadBaseContext {
return (lazyBatchSize > 1) ? lazyBatchSize : defaultBatchSize;
}
/**
* If the parent has a query plan label then extend it with the path and
* set onto the secondary query.
*/
void setLabel(SpiQuery<?> query) {
String label = parent.getPlanLabel();
if (label != null) {
label += "_" + fullPath;
query.setLabel(label);
query.setProfileLocation(parent.getProfileLocation());
}
}
protected PersistenceContext getPersistenceContext() {
return parent.getPersistenceContext();
}