Stored Procedure and Functions
If we want to access stored procedures and functions which are available at database from Spring Jdbc application then we have to use “SimpleJdbcCall”. To use SimpleJdbcCall in Spring Jdbc applications we have to use the following steps.
1. Create DAO interface and its implementation class.
2. In DAO implementation class, we have to declare DataSource and JdbcTemplate and its respective setter method.
3. Inside setter method we have to create SimpleJdbcCall object.
SimpleJdbcCall jdbcCall = new SimpleJdbcCall(); jdbcCall.withProcedureName("proc_Name");
4. Configure DataSource and DAO implementation class in beans configuration file.
5. Access “execute” method by passing IN type parameters values in the form of “SQLParameterSource”.
public Map execute(Map m) public Map execute(SqlParameterSource paramSource) public Map execute(Object ... obj)