DEV Community


Posted on

Streamlined Java Data Querying

I am on the hunt for a Java library or framework that can simplify database querying without the complexities and overhead associated with JPA mappings and the atrocities that surround it, like N+1 and such.

Background: I have previously explored using jOOQ and QueryDSL. Although they are robust, they do not quite meet my needs for simplicity and the specific handling of relationships I am looking for.


Simplicity and Fluency: The library should offer a simple, fluent API to define queries, making the code intuitive and easy to follow. Ideally a simple and readable way to specify filters and fetch strategy, much like GraphQL but way simpler.

Efficient Relationship Handling: It must efficiently handle entity relationships, possibly in a recursive manner, and offer the flexibility to decide which relationships to load and how.

Filtering Capabilities: Strong filtering options are essential, enabling the specification of various conditions to refine searches.

Example Use Case: Consider the need to fetch a list of Users who live in 'New York', and for each user, fetch their associated Posts from the last month. Additionally, for each post, there should be an option to selectively load related Comments based on specific criteria (like date or user ratings). The library would allow this to be defined in a fluent and readable way and executed in a simple and efficient manner, ideally in a single query or well-optimized batch of queries.

Does anyone know of such a Java library that aligns with these principles? Or, if not, would there be interest in the community for a new project that addresses these issues?

I appreciate any suggestions or insights, especially if there’s something less known that might be a good fit!

Thank you!

P.S. This could also include solutions that are agnostic about the specific type of datastore, embracing more abstract data management systems and not only those backed by a relational database.

Top comments (0)