Would a Base JdbiDao class be useful to other people?

Skip to first unread message

Devon Bush

May 11, 2023, 9:36:13 AMMay 11
to jDBI
Hi,  I've been using JDBI for the last few months on a new project--and it's been great!  Because it was a new project creating and iterating on a lot of classes quickly, I found it useful to create a base "BaseJdbiDao<Model>" class that my other DAOs inherit with create/update/find/count methods that use queries derived from the bean properties of their respective models.  I like that it lets me avoid having to write out all the basic SQL queries, while still using all the stuff I love about JDBI (POJO models, fast simple DAOs, etc...).  And then as the project matures, it's really easy to replace/override methods one-by-one with custom per-dao sql.  

I suspect this tooling of a BaseJdbiDao (perhaps paired with auto-generation of schema) would be helpful to other folks like myself who love using JDBI, but also like the convenience of auto-generating most of the sql at the beginning of projects.

My question is whether you think anyone else would find this useful (or if something like it already exists).  Right now it's just successfully used in my 4-person open source project (Github source for the BaseJdbiDao class), and I'm considering taking some time to package up just that functionality in its own library.  


Steven Schlansker

Jun 7, 2023, 1:20:35 PMJun 7
to jd...@googlegroups.com
Hi Devon,
This is an interesting idea, but somewhat outside of the scope of what Jdbi intends to provide at this time.
In particular, automatically generating SQL in a way that can both handle arbitrary Java types, and is cross-database compatible, is very tricky and there are entire other projects that tackle this problem.

If you come up with something you'd like to share, we'd love to see it! But the bar for inclusion in the base Jdbi distribution will be very high - the base class would need to help with many use cases, and not break when a user starts to use more advanced features.

Thanks for your interest!

Devon Bush

Jun 7, 2023, 1:32:50 PMJun 7
to jd...@googlegroups.com
Thanks for the reply -- totally agree that anything like this would be probably be outside the core jdbi featureset and make the most sense as an independent addon.  Just trying to gauge interest, since, as you say, generalizing this to be production-ready across many different databases/Java types would be a large effort.    

Cheers, and thanks

You received this message because you are subscribed to the Google Groups "jDBI" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jdbi+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jdbi/4E67A0C3-2BEB-4024-910B-C5C9DE76D83D%40gmail.com.
Reply all
Reply to author
0 new messages