Change *ToMany lazy loading to not use the parent entity/table

This commit is contained in:
Rob Bygrave
2014-01-30 22:27:52 +13:00
parent 87a948223c
commit 749f8d0d45
36 changed files with 542 additions and 190 deletions
@@ -30,15 +30,13 @@ public class DLoadManyContext extends DLoadBaseContext implements LoadManyContex
super(parent, property.getBeanDescriptor(), path, defaultBatchSize, queryProps);
this.property = property;
this.currentBuffer = createBuffer(firstBatchSize);
this.bufferList = queryFetch ? new ArrayList<DLoadManyContext.LoadBuffer>() : null;
this.bufferList = new ArrayList<DLoadManyContext.LoadBuffer>();
this.currentBuffer = createBuffer(firstBatchSize);
}
private LoadBuffer createBuffer(int size) {
LoadBuffer buffer = new LoadBuffer(this, size);
if (bufferList != null) {
bufferList.add(buffer);
}
bufferList.add(buffer);
return buffer;
}
@@ -48,10 +46,10 @@ public class DLoadManyContext extends DLoadBaseContext implements LoadManyContex
if (parent.isReadOnly() != null){
query.setReadOnly(parent.isReadOnly());
}
query.setParentNode(getObjectGraphNode());
query.setParentNode(objectGraphNode);
if (queryProps != null){
queryProps.configureManyQuery(query);
queryProps.configureBeanQuery(query);
}
if (parent.isUseAutofetchManager()){
@@ -59,20 +57,6 @@ public class DLoadManyContext extends DLoadBaseContext implements LoadManyContex
}
}
public ObjectGraphNode getObjectGraphNode() {
// we return the parent node ... as we actually
// query on the parent selecting just it's id
int pos = path.lastIndexOf('.');
if (pos == -1){
return parent.getObjectGraphNode(null);
} else {
String parentPath = path.substring(0, pos);
return parent.getObjectGraphNode(parentPath);
}
}
public BeanPropertyAssocMany<?> getBeanProperty() {
return property;
}
@@ -156,7 +140,7 @@ public class DLoadManyContext extends DLoadBaseContext implements LoadManyContex
@Override
public ObjectGraphNode getObjectGraphNode() {
return context.getObjectGraphNode();
return context.objectGraphNode;
}
@Override