#1251: DBQueryBuilder.kt
projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/api/impl/DBQueryBuilder.kt Query Orchestrator, projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/api/impl/DBQueryBuilder.kt 162 lines · 98 code · 48 comments · 16 blank
Top-level query builder that routes between DBQueryBuilderByCriteria (JPA Criteria API) and DBQueryBuilderByFullText (Hibernate Search). Decides the query mode based on whether any DBPredicate lacks criteria support, then delegates filtering, ordering, and result iteration accordingly.
Architecture
Constructor Dependencies
- baseDao
BaseDao<O> — entity DAO providing DO class
- entityManager — JPA EntityManager
- queryFilter
QueryFilter — filter with join definitions
- dbFilter
DBFilter — predicate and sort configuration
Query Modes
| Mode | Description |
FULLTEXT | Hibernate Search full-text query (default when predicates lack criteria support) |
MULTI_FIELD_FULLTEXT_QUERY | Query string (e.g. "+name:sch* +kassel..."), not yet implemented |
CRITERIA | JPA Criteria API query |
Predicate Routing
In init, predicates are classified into criteriaPredicates, fullTextPredicates, or resultPredicates (post-query in-memory filtering). A predicate is routed to the result set if it supports neither criteria nor full-text search. Logging via KotlinLogging reports ignored predicates.
Key Methods
| Method | Description |
result(): DBResultIterator<O> | Returns either a full-text or criteria result iterator |
addOrder(sortProperty) | Adds sorting, delegated to the active sub-builder; max 3 sort properties |
Git History
868d6abb7 2025 -> 2026
63081666f Source file headers: 2024-> 2025.
313bed1ec Merge remote-tracking branch 'origin/master' into mgc-remove
314408ee0 Migration stuff in progress... (all tests of all packages: OK).
4000abf4e Migration stuff in progress...