4 ms·
Someone else mentioned jOOQ, but personally I also rather enjoyed JDBI3: https://jdbi.org/#_introduction_to_jdbi_3 https://jdbi.org/#_introduction_to_jdbi_3 It
by KronisLV 3y ago
Someone else mentioned jOOQ, but personally I also rather enjoyed JDBI3: https://jdbi.org/#_introduction_to_jdbi_3 https://jdbi.org/#_introduction_to_jdbi_3
It addresses the issues with using JDBC directly (not nice ergonomics), while still letting you work with SQL directly without too many abstractions in the middle. In combination with Dropwizard, it was pretty pleasant: https://www.dropwizard.io/en/stable/manual/jdbi3.html https://www.dropwizard.io/en/stable/manual/jdbi3.html
Other than that, I actually liked using myBatis with XML mappers: https://mybatis.org/mybatis-3/sqlmap-xml.html https://mybatis.org/mybatis-3/sqlmap-xml.html and their dynamic functionality: https://mybatis.org/mybatis-3/dynamic-sql.html https://mybatis.org/mybatis-3/dynamic-sql.html
It might sound a bit of crazy on the surface, but their DSL actually made sense and was intertwined with the SQL you wrote, a bit like templating that you might use for front end stuff, except that directly for your database queries. It was great for adding complex WHERE parts for specific filters or re-using parts of queries.
Either way, it's nice to have various different options and to also have some newcomers.
- nmadden 3y agoJDBI3 looks nice. I previously had good experiences with Dalesbred (https://dalesbred.org https://dalesbred.org), which sounds similar to JDBI3's fluent API -- a fairly minimal layer over JDBC with better ergonomics.
- icedchai 3y agoI've used JDBI in the past. It seems pretty solid, light weight, and eliminated much of the repetition/ceremony involved with plain old JDBC. I generally can't stand Java ORMs (Hibernate, anyone?)