feat: add GROUP BY, HAVING and Query/AdvancedQuery separation#143
Merged
brunomendola merged 3 commits intoqueritylib:mainfrom Jan 16, 2026
Merged
Conversation
Add support for GROUP BY and HAVING clauses with a clear separation between simple entity queries and projection queries. API Changes: - Query: simplified for entity-only queries (filter, sort, pagination, distinct) - AdvancedQuery: for projections with SELECT, GROUP BY, HAVING clauses - QueryDefinition: common interface for both query types - Querity.advancedQuery(): new entry point for projection queries - Querity.findAllProjected(): returns List<Map<String, Object>> New Features: - GROUP BY with property names or expressions - HAVING clause for aggregate filtering - AdvancedQueryPreprocessor for preprocessing advanced queries - JpaQueryUtils to reduce code duplication Implementation: - JPA, MongoDB, Elasticsearch backend support - Parser support for GROUP BY and HAVING - Semantic validation (HAVING requires GROUP BY) - Null validation in withPreprocessor() methods - Immutable preprocessors list using List.copyOf() - Standardized exception handling across all factories
brunomendola
requested changes
Jan 15, 2026
querity-api/src/main/java/io/github/queritylib/querity/api/SimpleGroupBy.java
Outdated
Show resolved
Hide resolved
...-spring-web/src/test/java/io/github/queritylib/querity/spring/web/QueritySpringWebTests.java
Show resolved
Hide resolved
- Update README examples to use advancedQuery() for projections and GROUP BY - Add MockMvc integration tests for AdvancedQuery JSON binding - Allow mixing propertyNames and expressions in SimpleGroupBy and SimpleSelect - Add .factorypath to .gitignore
f9d9482 to
85fcfff
Compare
- Remove FUNCTION shorthand from ConditionDeserializer as it was untested and could cause issues with field mixing - Keep explicit leftExpression format which is properly tested - Document getEffectiveExpressions() ordering behavior in SimpleGroupBy and SimpleSelect Javadoc to clarify that propertyNames come before expressions, and interleaved insertion order is not preserved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for GROUP BY and HAVING clauses with a clear separation between simple entity queries and projection queries.
API Changes:
New Features:
Implementation: