#1254: DBResultIterator.kt

projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/api/impl/DBResultIterator.kt Result Iteration, projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/api/impl/DBResultIterator.kt 102 lines · 58 code · 31 comments · 13 blank
Generic interface and implementations for iterating over database search results. Provides DBCriteriaResultIterator using Hibernate ScrollableResults with entity graph support, and DBEmptyResultIterator for empty query results.

Architecture

Interface

interface DBResultIterator<O : ExtendedBaseDO<Long>> {
    fun next(): O?
    fun sort(list: List<O>): List<O>
}

Implementations

ClassDescription
DBEmptyResultIteratorReturns null for next(); identity sort. Used for queries with no results.
DBCriteriaResultIteratorWraps ScrollableResults from jakarta.persistence.Query. Supports entity graph hints (jakarta.persistence.loadgraph) and flushes entity manager every 100 iterations. Catches exceptions in next() with error logging.

Constructor Dependencies (DBCriteriaResultIterator)

Git History

868d6abb7 2025 -> 2026
63081666f Source file headers: 2024-> 2025.
313bed1ec Merge remote-tracking branch 'origin/master' into mgc-remove
9aff90908 Migration stuff in progress... (all tests of all packages: OK).
b71b5073d Migration stuff in progress... (all tests of all packages: OK).