Hello everyone,

I hope this message finds you well. I’d like to share an idea for a 
potential feature request, inspired by a brief discussion on SO with Lukas.

*INTRO* When starting a Java Spring project, developers often use JPA for 
data mapping because it allows for quick and straightforward setup. 
However, as the project grows, they start encountering performance issues 
like the infamous N+1 problem et similia. 

At this stage, devs make one of the two things happen:

   1. Refactoring JPA Mappings: They push themselves to restructure 
   mappings and use more efficient querying mechanisms with JPA.
   2. Switching to Alternatives: They opt for alternatives like JOOQ or 
   QueryDSL to handle their queries.

Unfortunately, most of the times ,both approaches result in code that is 
hard to read, inconsistent, and difficult to maintain. At least in my 
experience.

*THE IDEA *Here’s the idea: a strongly opinionated way of defining queries 
that starts from the basic thought steps when dealing with data querying in 
Java. The focus would be on defining a query plan with filter criteria and 
specifying what to load and how it should be loaded, possibly even in a 
recursive fashion.

   1. Specify Filters: A straightforward mechanism to define and apply 
   filters to the data set.
   2. Specify What to Fetch: A clear way to determine which fields to 
   retrieve.
   3. Recursive Query Plan: The ability to define a query plan that can 
   handle recursive fetching and recursive criteria, ensuring that related 
   data is queried efficiently.

At a glance it could look something like this: 
https://github.com/thestroke82/leanquery/blob/master/src/main/java/org/frappa/leanquery/controller/CustomerController.java
 
I've worked with a custom solution very much like this in the past and 
observed it performing its job remarkably well. The strongest advantage of 
such an approach is that as the codebase grows, readability remains 
practically constant, significantly improving maintainability. *CONCLUSION *The 
ideas are now out in the open, both in words and code (see the GitHub link 
above). I’m eager to hear your thoughts and advice, and I hope we can work 
together to evolve this concept into a formal feature request for JOOQ. 

One final request: Please refrain from comments that patronize or dismiss 
the idea with statements like "JPA already does that" or "X does that too." 
Instead, I’m looking for constructive feedback and suggestions on how we 
can make this feature a valuable addition to the JOOQ ecosystem.

Thank you for your time and consideration. I look forward to your feedback 
and collaboration!

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jooq-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/99bbd0c3-e5af-4ee7-a897-7ff869098288n%40googlegroups.com.

Reply via email to