Activity
Mon
Wed
Fri
Sun
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
Jan
Feb
What is this?
Less
More

Memberships

Amigoscode

1.3k members • Free

1 contribution to Amigoscode
Building a Cleaner Projection Layer on Top of JPA Criteria API
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. If this resonates with challenges you’ve faced, I’d love for you to take a look at the documentation and the GitHub repository. Feel free to try it out, open issues, suggest improvements, or share your feedback. Contributions and ideas are always welcome!
0 likes • 3d
@Ömer Fadıl Usta Great question! Both solve similar problems, but with different philosophies: ProjectionQuery: Lightweight, annotation-based, focused on simplicity - Minimal learning curve (only @Projection and @ProjectionField) - Framework-agnostic core (works anywhere JPA works) - JAR file size of approximately 50 KB - Ideal for: REST APIs, microservices Blaze-Persistence: Feature-rich query framework - Powerful, but with a steeper learning curve - Tightly coupled to specific JPA providers - Full query DSL with advanced features (CTEs, window functions, etc.) Think of ProjectionQuery as "doing one thing well" - we focus exclusively on projections with type safety and automatic join resolution. If you need advanced SQL features, Blaze is more suitable. If you want simple and clean DTOs without the complexity, ProjectionQuery is the best option. Can they work together? Absolutely. You can use ProjectionQuery for your API DTOs and Blaze-Persistence for complex report queries in the same application. Both solve real problems, just different ones.
1-1 of 1
Júlio Bueno
1
3points to level up
@julio-bueno-9658
Debugging...

Active 6h ago
Joined Feb 12, 2026
Goiânia, BR
Powered by