Skip to content

Commit b5d39dc

Browse files
committed
http://code.google.com/p/mybatis/issues/detail?id=129 , config property to allow using RowBounds on associations
1 parent f025268 commit b5d39dc

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

src/main/java/org/apache/ibatis/builder/xml/XMLConfigBuilder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ private void settingsElement(XNode context) throws Exception {
178178
configuration.setDefaultExecutorType(ExecutorType.valueOf(stringValueOf(props.getProperty("defaultExecutorType"), "SIMPLE")));
179179
configuration.setDefaultStatementTimeout(integerValueOf(props.getProperty("defaultStatementTimeout"), null));
180180
configuration.setMapUnderscoreToCamelCase(booleanValueOf(props.getProperty("mapUnderscoreToCamelCase"), false));
181+
configuration.setSafeRowBoundsEnabled(booleanValueOf(props.getProperty("safeRowBoundsEnabled"), true));
181182
}
182183
}
183184

src/main/java/org/apache/ibatis/executor/resultset/NestedResultSetHandler.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ public NestedResultSetHandler(Executor executor, MappedStatement mappedStatement
3131
super(executor, mappedStatement, parameterHandler, resultHandler, boundSql, rowBounds);
3232
localRowValueCaches = new HashMap<CacheKey, Set<CacheKey>>();
3333
globalRowValueCache = new HashMap<CacheKey, Object>();
34-
ensureNoRowBounds(rowBounds);
34+
if (configuration.isSafeRowBoundsEnabled()) {
35+
ensureNoRowBounds(rowBounds);
36+
}
3537
}
3638

3739
private void ensureNoRowBounds(RowBounds rowBounds) {

src/main/java/org/apache/ibatis/session/Configuration.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public class Configuration {
5959

6060
protected Environment environment;
6161

62+
protected boolean safeRowBoundsEnabled = true;
6263
protected boolean mapUnderscoreToCamelCase = false;
6364
protected boolean lazyLoadingEnabled = false;
6465
protected boolean aggressiveLazyLoading = true;
@@ -116,6 +117,14 @@ public Configuration() {
116117
typeAliasRegistry.registerAlias("WEAK", WeakCache.class.getName());
117118
}
118119

120+
public boolean isSafeRowBoundsEnabled() {
121+
return safeRowBoundsEnabled;
122+
}
123+
124+
public void setSafeRowBoundsEnabled(boolean safeRowBoundsEnabled) {
125+
this.safeRowBoundsEnabled = safeRowBoundsEnabled;
126+
}
127+
119128
public boolean isMapUnderscoreToCamelCase() {
120129
return mapUnderscoreToCamelCase;
121130
}

0 commit comments

Comments
 (0)