mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user