Add the [+query,+cache,+lazy] query type to the profile label

This commit is contained in:
Rob Bygrave
2023-04-06 21:59:51 +12:00
parent ecd27e145e
commit af613d3096
4 changed files with 12 additions and 2 deletions
@@ -23,4 +23,5 @@ public interface LoadBeanBuffer {
void configureQuery(SpiQuery<?> query, String lazyLoadProperty);
boolean isCache();
}
@@ -77,7 +77,7 @@ public final class LoadBeanRequest extends LoadRequest {
public void configureQuery(SpiQuery<?> query, List<Object> idList) {
query.setMode(Mode.LAZYLOAD_BEAN);
query.setPersistenceContext(loadBuffer.persistenceContext());
query.setLoadDescription(lazy ? "+lazy" : "+query", description());
query.setLoadDescription(mode(), description());
if (lazy) {
query.setLazyLoadBatchSize(loadBuffer.batchSize());
if (alreadyLoaded) {
@@ -97,6 +97,10 @@ public final class LoadBeanRequest extends LoadRequest {
}
}
private String mode() {
return lazy ? "+lazy" : loadBuffer.isCache() ? "+cache" : "+query";
}
/**
* Load the beans into the L2 cache if that is requested and check for load failures due to deletes.
*/
@@ -52,7 +52,7 @@ abstract class DLoadBaseContext {
void setLabel(SpiQuery<?> query) {
String label = parent.planLabel();
if (label != null) {
query.setProfilePath(label, fullPath, parent.profileLocation());
query.setProfilePath(label, fullPath + "(" + query.getLoadMode() + ")", parent.profileLocation());
}
}
@@ -189,6 +189,11 @@ final class DLoadBeanContext extends DLoadBaseContext implements LoadBeanContext
context.configureQuery(query, lazyLoadProperty);
}
@Override
public boolean isCache() {
return context.cache;
}
@Override
public void loadBean(EntityBeanIntercept ebi) {
// A lock is effectively held by EntityBeanIntercept.loadBean()