Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Java
Expertise: Intermediate
Mar 10, 2017

Using a JDBC Template

Spring provides a nice abstraction on top of the JDBC API using JdbcTemplate and also provides great transaction management capabilities using annotation-based approach. By using the JdbcTemplate and NamedParameterjdbcTemplate classes, we can take advantage of auto configuration features and eliminate the need to configure beans by ourselves, as you can see below:

public class MyFoo{

   private final JdbcTemplate jdbcTemplate;

   public MyFoo(JdbcTemplate jdbcTemplate){
            this.jdbcTemplate = jdbcTemplate;
Octavia Anghel
Thanks for your registration, follow us on our social networks to keep up-to-date