mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-19 23:02:24 +00:00
#821 - CQueryIteratorSimple not working with consecutive calls to hasNext() - ie. without matching calls to next()
This commit is contained in:
1 parent
014a9aef6f
commit
4f98ca5d91
2 files changed
+45
-1
No files matched your search
@@ -83,6 +83,11 @@ public class CQuery<T> implements DbReadContext, CancelableQuery {
|
||||
*/
|
||||
private EntityBean currentBean;
|
||||
|
||||
/**
|
||||
* Caches hasNext for consecutive hasNext() calls.
|
||||
*/
|
||||
private boolean hasNextCache;
|
||||
|
||||
private final BeanPropertyAssocMany<?> lazyLoadManyProperty;
|
||||
|
||||
private Object lazyLoadParentId;
|
||||
@@ -504,6 +509,7 @@ public class CQuery<T> implements DbReadContext, CancelableQuery {
|
||||
if (auditFindIterate) {
|
||||
auditIterateNextBean();
|
||||
}
|
||||
hasNextCache = false;
|
||||
return nextBean;
|
||||
}
|
||||
|
||||
@@ -513,7 +519,11 @@ public class CQuery<T> implements DbReadContext, CancelableQuery {
|
||||
if (noMoreRows || cancelled || loadedBeanCount >= maxRowsLimit) {
|
||||
return false;
|
||||
}
|
||||
return readNextBean();
|
||||
if (hasNextCache) {
|
||||
return true;
|
||||
}
|
||||
hasNextCache = readNextBean();
|
||||
return hasNextCache;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user