Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 731
yannisf Avatar asked Aug 25 '15 13:08

yannisf


2 Answers

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.

like image 63
Ioannis Sermetziadis Avatar answered Oct 18 '22 21:10

Ioannis Sermetziadis


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.

like image 25
Markos Fragkakis Avatar answered Oct 18 '22 22:10

Markos Fragkakis