If you develop systems using Java with JPA, you have probably faced the need to execute queries that return only a subset of attributes from a given entity.
At first glance, this may seem simple. However, when not handled properly, systems tend to accumulate redundant queries or methods that load entire entities when only a few attributes are actually needed.
In many real-world scenarios, we often need to retrieve only fields like “id” and “name”. In large or complex systems, it becomes difficult to know whether a specific projection already exists. As a result, developers either duplicate queries or reuse methods that fetch more data than necessary.
ProjectionQuery was created to address exactly this problem. It provides a clean and expressive way to define projection-based queries, helping you select only the data your application truly needs, in an organized and reusable way.
Feel free to try it out, open issues, suggest improvements, or share your feedback. Contributions and ideas are always welcome!