{"id":36937709,"url":"https://github.com/juliocmbueno/jb-projects-projection-query","last_synced_at":"2026-02-18T22:08:32.684Z","repository":{"id":326090005,"uuid":"1101497194","full_name":"juliocmbueno/jb-projects-projection-query","owner":"juliocmbueno","description":"ProjectionQuery is a lightweight, type-safe, and framework-agnostic query projection library for Java.  ","archived":false,"fork":false,"pushed_at":"2026-02-03T16:35:23.000Z","size":212,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-02-04T05:59:03.692Z","etag":null,"topics":["framework","java","query-builder"],"latest_commit_sha":null,"homepage":"https://github.com/juliocmbueno/jb-projects-projection-query","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juliocmbueno.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["juliocmbueno"],"custom":["https://github.com/sponsors/juliocmbueno"]}},"created_at":"2025-11-21T18:59:01.000Z","updated_at":"2026-02-03T16:40:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"37de94bb-e5a5-4152-86e7-e876f4a223f4","html_url":"https://github.com/juliocmbueno/jb-projects-projection-query","commit_stats":null,"previous_names":["juliocmbueno/jb-projects-projection-query"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/juliocmbueno/jb-projects-projection-query","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliocmbueno%2Fjb-projects-projection-query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliocmbueno%2Fjb-projects-projection-query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliocmbueno%2Fjb-projects-projection-query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliocmbueno%2Fjb-projects-projection-query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juliocmbueno","download_url":"https://codeload.github.com/juliocmbueno/jb-projects-projection-query/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliocmbueno%2Fjb-projects-projection-query/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29596446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T20:59:56.587Z","status":"ssl_error","status_checked_at":"2026-02-18T20:58:41.434Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["framework","java","query-builder"],"created_at":"2026-01-13T10:09:57.723Z","updated_at":"2026-02-18T22:08:32.678Z","avatar_url":"https://github.com/juliocmbueno.png","language":"Java","funding_links":["https://github.com/sponsors/juliocmbueno"],"categories":[],"sub_categories":[],"readme":"# ProjectionQuery [![Test Pipeline](https://github.com/juliocmbueno/jb-projects-projection-query/actions/workflows/maven.yml/badge.svg)](https://github.com/juliocmbueno/jb-projects-projection-query/actions/workflows/maven.yml) [![Coverage Status](https://coveralls.io/repos/github/juliocmbueno/jb-projects-projection-query/badge.svg?branch=main)](https://coveralls.io/github/juliocmbueno/jb-projects-projection-query?branch=main)\n\n**ProjectionQuery** is a lightweight, type-safe, and framework-agnostic query projection library for Java.  \nIt provides an API for building database projections dynamically — without exposing entity models and without relying on complicated frameworks.\n\nThe project is split into multiple modules:\n\n- **projection-core** — The core engine containing the projection API.\n- **projection-spring** — Spring Data integration.\n- **projection-examples** — Sample use cases and demonstration scenarios.\n\n---\n\n## Motivation\n\nIn many enterprise applications, returning entire entities to the client is unnecessary and often harmful.  \nProjectionQuery addresses this by allowing developers to:\n\n- Build **explicit projections**.\n- Select **only the fields you need**.\n- Reduce data transfer size.\n- Avoid exposing full entity structures.\n- Generate type-safe, model-independent results.\n\n---\n\n## Modules\n\n### **projection-core**\nThe main module containing:\n\n- `ProjectionQuery` - It serves as the entry point for the projection engine, allowing you to define filters, specifications, ordering, and pagination in a fluent way. It encapsulates all the configuration required to execute a projection.\n- `ProjectionProcessor` - Core engine for executing projection queries\n- `ProjectionPage` - A wrapper for paginated projection results, containing the list of items and pagination metadata.\n- `@Projection` - Indicates that the annotated class is a projection for a specific entity.\n- `@ProjectionField` - Indicates that the annotated field is a projection field with optional aggregation functions.\n- `@ProjectionJoin` - Indicates a join to be used in a projection. Should be used when there is a need to change the join type or define an alias for the join.\n- Utility abstractions for type-safe projections\n\nThis module is fully independent and can be used in **any** Java application — with or without frameworks.\n\n### **projection-spring**\nProvides integration with Spring Data:\n\n- Automatic projection query execution\n- Seamless compatibility with `JpaRepository`\n- Spring-managed projection transformers\n\n---\n\n##  Installation (Maven)\n\n### standalone usage\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.juliocmbueno\u003c/groupId\u003e\n    \u003cartifactId\u003eprojection-core\u003c/artifactId\u003e\n    \u003cversion\u003e3.4.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### spring usage\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.juliocmbueno\u003c/groupId\u003e\n    \u003cartifactId\u003eprojection-spring-data\u003c/artifactId\u003e\n    \u003cversion\u003e3.4.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n---\n## Basic Usage\n\nFirst, create a class that will represent your query.\n```java\n@Projection(of = Customer.class)\npublic record CustomerBasicData(\n        @ProjectionField Long id,\n        @ProjectionField String name,\n        @ProjectionField(\"address.city.name\") String city,\n        @ProjectionField(\"address.city.state.name\") String state\n) { }\n```\n\n\u003e In the following examples, we assume a JPA context in which the `ProjectionProcessor` receives an `EntityManager` instance, responsible for executing the queries.\n\n**1. Example using a projection class:**\n```java\nProjectionProcessor processor = new ProjectionProcessor(entityManager);\nList\u003cCustomerBasicData\u003e customers = processor.execute(CustomerBasicData.class);\n```\n\n**2. Example using a fully configured ProjectionQuery:**\n```java\nProjectionProcessor processor = new ProjectionProcessor(entityManager);\n\nProjectionQuery\u003cCustomer, CustomerBasicData\u003e query = ProjectionQuery\n    .fromTo(Customer.class, CustomerBasicData.class)\n    .filter(\"address.city.name\", ProjectionFilterOperator.EQUAL, \"São Paulo\")\n    .order(\"name\", OrderDirection.ASC)\n    .paging(0, 20)\n    .distinct();\n\nList\u003cCustomerBasicData\u003e customers = processor.execute(query);\n```\n\n**3. Example using ProjectionPage result:**\n```java\nProjectionProcessor processor = new ProjectionProcessor(entityManager);\n\nProjectionQuery\u003cCustomer, CustomerBasicData\u003e query = ProjectionQuery\n    .fromTo(Customer.class, CustomerBasicData.class)\n    .paging(0, 20);\n\nProjectionPage\u003cCustomerBasicData\u003e page = processor.executePageable(query);\n```\n\n---\n## Examples\n\nThe `projection-examples` module contains sample use cases and demonstration scenarios for using ProjectionQuery.\n\n📚 **Official Documentation:**  \nBefore exploring the examples, you may want to check the full documentation available at:  \n👉 https://juliocmbueno.github.io/jb-projects-projection-query/\n\nThe documentation provides a structured guide covering projections, filters, pagination, execution, custom handlers, logging, and Spring Boot integration.\n\n### Explore the examples\n\n- **All examples of projections:**  \n  Browse all classes in the [projections package](https://github.com/juliocmbueno/jb-projects-projection-query/tree/main/projection-examples/src/main/java/br/com/jbProjects/domain/projections).\n\n- **Standalone usage (without Spring):**  \n  See the [ProjectionsStandaloneExample](https://github.com/juliocmbueno/jb-projects-projection-query/blob/main/projection-examples/src/main/java/br/com/jbProjects/standalone/ProjectionsStandaloneExample.java) class for examples using `ProjectionProcessor` directly with an `EntityManager`.\n\n- **Spring integration:**  \n  See the [ProjectionsSpringExample](https://github.com/juliocmbueno/jb-projects-projection-query/blob/main/projection-examples/src/main/java/br/com/jbProjects/spring/ProjectionsSpringExample.java) class for examples using Spring-managed beans.\n\n---\n## Documentation\nFull Javadoc is available inside the `projection-core` module and will also be published to Maven Central once the artifacts are public.\n\n---\n## Licence\nProjectionQuery is licensed under the Apache License 2.0.\n\nSee the LICENSE file for full details.\n\n---\n## Contributing\nContributions are welcome!\n\nFeel free to submit issues, suggestions, or pull requests.\n\n---\n## Author\n\nDeveloped and maintained by Júlio Bueno.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliocmbueno%2Fjb-projects-projection-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliocmbueno%2Fjb-projects-projection-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliocmbueno%2Fjb-projects-projection-query/lists"}