JDBCTemplate for JavaEE and CDI

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, like what the JDBCTemplate for Spring does. Obviously adding Spring as a dependency is not an option.

+5
source share
2 answers

I would look at MyBatis (formerly iBatis).

MyBatis is a first-class persistence system with support for custom SQL, stored procedures, and advanced mappings. MyBatis eliminates almost all JDBC code and manually adjusts parameters and searches for results. MyBatis can use simple XML or annotations for configuration primitives and maps, map interfaces and Java POJOs (regular old Java objects) for database entries.

+2
source

I would suggest Apache commons-dbutils , which is a lightweight library for JDBC operations. It provides a QueryRunner class that seems very similar to Spring's JDBCTemplate.

+1
source

All Articles