I am working on a JavaEE7/CDI project that makes heavy use of pure JDBC code.
Is there a library that could help me eliminate the boilerplate code, much like what JDBCTemplate does for Spring. Obviously adding Spring as dependency is not an option.
I would suggest the Apache commons-dbutils, which is a light library for JDBC operations. It provides the QueryRunner class that seems very similar to Spring's JDBCTemplate.
I would look into MyBatis (formerly iBatis).
MyBatis is a first class persistence framework with support for custom SQL, stored procedures and advanced mappings. MyBatis eliminates almost all of the JDBC code and manual setting of parameters and retrieval of results. MyBatis can use simple XML or Annotations for configuration and map primitives, Map interfaces and Java POJOs (Plain Old Java Objects) to database records.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With