Feature/projection by vage88sg1 · Pull Request #130 · queritylib/querity

and others added 7 commits

December 5, 2025 20:05
- Add Select interface and SimpleSelect implementation
- Add NativeSelectWrapper for native select support
- Add hasSelect() and getSelect() to Query
- Add selectBy() method to QueryBuilder (renamed from select to avoid Jackson conflict)
- Add findAllProjected() method to Querity interface with default implementation
- Implement projection support in JPA module (JpaSelect, JpaSimpleSelect, JpaQueryFactory)
- Implement projection support in MongoDB module (MongodbSelect, MongodbSimpleSelect, MongodbQueryFactory)
- Implement projection support in Elasticsearch module (ElasticsearchSelect, ElasticsearchSimpleSelect, ElasticsearchQueryFactory)
- Add SELECT keyword to parser grammar
- Add SelectUtils for native select wrapper resolution
- Add tests for select in spring-web module

Note: Using SimpleSelect (concrete class) instead of Select (interface) in Query
to avoid Jackson deserialization issues with polymorphic types.
- Add SimpleSelectTest for API module
- Add JpaSelectTests for JPA module
- Add parser tests for SELECT keyword in QuerityParserTests
- Create SelectDeserializer following the same pattern as ConditionDeserializer
- Register SelectDeserializer in QuerityModule
- Change Query.select from SimpleSelect to Select interface
- Add getPropertyNames() method to Select interface
- Update JpaSelect, MongodbSelect, ElasticsearchSelect to accept Select interface
- Update QueryVisitor to use Select interface

This approach is more consistent with how Condition is handled and allows
for proper polymorphic deserialization of Select implementations.
- Create SortDeserializer following the same pattern as ConditionDeserializer and SelectDeserializer
- Register SortDeserializer in QuerityModule
- Remove @JsonTypeInfo/@JsonSubTypes annotations from Sort interface

Now all three interfaces (Condition, Select, Sort) use custom deserializers
registered in QuerityModule for consistent and predictable JSON parsing.
- Add NativeSelectWrapperTest for API module
- Add DeserializerTests for SelectDeserializer and SortDeserializer
- Add test for unsupported Select type in JpaSelectTests
- Coverage improvements:
  - querity-api: 98%
  - querity-spring-web: 99%
  - querity-jpa-common: 78%
- Add DateValueExtractorTests for Date value extraction
- Add SelectUtilsTests for NativeSelectWrapper handling
- Add SpecificationTests for JPA Specification.where()
- Add projection tests for Elasticsearch, MongoDB, and JPA
- Add additional parser tests for edge cases
- Fix DeserializerTests assertions for exception handling
- Extend JpaSelectTests with NativeSelectWrapper tests
- Configure JaCoCo to exclude ANTLR generated classes

riccardovagelli and others added 2 commits

December 6, 2025 22:06
- Add SelectTests to QuerityGenericTestSuite with tests for selectBy
- Add SelectionSpecification interface for native JPA selection expressions
- Add AliasedSelectionSpecification for selections with custom aliases
- Add JpaSelectionSpecificationSelectWrapper for native select support
- Add selectByNative tests with concat expression in JPA test classes
- Add sortByNative test with expression (cb.length) in JPA test classes
- Update README with documentation for projections and native expressions
- Update JpaSelect interface to include CriteriaBuilder parameter

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

@claude

- givenSelectByTwoFields: relax lastName assertion (null values may be
  excluded from projections in MongoDB/Elasticsearch)
- givenSelectByNestedField: accept both flat 'city' and nested
  'address.city' structures (Elasticsearch returns nested structure)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

brunomendola

riccardovagelli and others added 2 commits

December 8, 2025 22:51
- Relocate selectByNative tests from SpringPostgresqlQuerityJpaImplTests to QuerityJpaImplTests
- Tests validate SQL database behavior generally, not Postgres-specific edge cases
- Enhance givenSelectByTwoFields test with lastName IS_NOT_NULL filter
- Restore lastName containsKey assertion for more robust validation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>