October 2017
Intermediate to advanced
396 pages
10h 2m
English
We can use the Spring's JdbcTemplate class to implement the repositories in a Spring application. Let's see how to implement the repository class based on the JDBC template:
package com.packt.patterninspring.chapter7.bankapp.repository; import java.sql.ResultSet; import java.sql.SQLException; import javax.sql.DataSource; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import org.springframework.stereotype.Repository; import com.packt.patterninspring.chapter7.bankapp.model.Account; @Repository public class JdbcAccountRepository implements AccountRepository{ JdbcTemplate jdbcTemplate; public JdbcAccountRepository(DataSource dataSource) { super(); this.jdbcTemplate ...Read now
Unlock full access