Revert to old style, unsegmented collection loading as default and only do segmented loading when collection.loadmode = lazy is set.

This commit is contained in:
hns 2009-11-24 10:34:50 +00:00
parent 3250ba7c00
commit e14f335253
2 changed files with 20 additions and 3 deletions

View file

@ -1441,7 +1441,9 @@ public final class Node implements INode {
* @return List an empty List of the type used by this Node * @return List an empty List of the type used by this Node
*/ */
public SubnodeList createSubnodeList() { public SubnodeList createSubnodeList() {
subnodes = new SegmentedSubnodeList(this); Relation subrel = dbmap == null ? null : dbmap.getSubnodeRelation();
subnodes = subrel == null || !subrel.lazyLoading ?
new SubnodeList(this) : new SegmentedSubnodeList(this);
return subnodes; return subnodes;
} }

View file

@ -82,6 +82,7 @@ public final class Relation {
Constraint[] constraints; Constraint[] constraints;
boolean virtual; boolean virtual;
boolean readonly; boolean readonly;
boolean lazyLoading;
boolean aggressiveLoading; boolean aggressiveLoading;
boolean aggressiveCaching; boolean aggressiveCaching;
boolean isPrivate = false; boolean isPrivate = false;
@ -128,6 +129,7 @@ public final class Relation {
this.constraints = rel.constraints; this.constraints = rel.constraints;
this.accessName = rel.accessName; this.accessName = rel.accessName;
this.logicalOperator = rel.logicalOperator; this.logicalOperator = rel.logicalOperator;
this.lazyLoading = rel.lazyLoading;
this.aggressiveLoading = rel.aggressiveLoading; this.aggressiveLoading = rel.aggressiveLoading;
this.aggressiveCaching = rel.aggressiveCaching; this.aggressiveCaching = rel.aggressiveCaching;
this.updateCriteria = rel.updateCriteria; this.updateCriteria = rel.updateCriteria;
@ -298,8 +300,21 @@ public final class Relation {
protected void parseOptions(Vector cnst, Properties props) { protected void parseOptions(Vector cnst, Properties props) {
String loading = props.getProperty("loadmode"); String loading = props.getProperty("loadmode");
aggressiveLoading = (loading != null) && if (loading != null) {
"aggressive".equalsIgnoreCase(loading.trim()); loading = loading.trim();
if ("aggressive".equalsIgnoreCase(loading)) {
aggressiveLoading = true;
lazyLoading = false;
} else if ("lazy".equalsIgnoreCase(loading)) {
lazyLoading = true;
aggressiveLoading = false;
} else {
System.err.println("Unsupported loadmode property in " + ownType + ": " + loading);
aggressiveLoading = lazyLoading = false;
}
} else {
aggressiveLoading = lazyLoading = false;
}
String caching = props.getProperty("cachemode"); String caching = props.getProperty("cachemode");