Submitted by: Octavia Anghel(octaviaanghel@gmail.com)

Tuesday May 12th 2020 by Octavia Anghel
Article Image

Language: Java, Expertise: Intermediate - See an example of how to call a stored procedure via the JdbcTemplate.

Let's consider a stored procedure named FOO that return a List. We can call it via JdbcTemplate as follows:

public class FooService {

  private final JdbcTemplate jdbcTemplate;

  public FooService(JdbcTemplate jdbcTemplate) {
    this.jdbcTemplate = jdbcTemplate;

  public List callFOO() {
    SimpleJdbcCall simpleJdbcCall = new SimpleJdbcCall(jdbcTemplate)

    Map foos = simpleJdbcCall.execute(...);

    return (List) authors.get("FooResultSet");
Mobile Site | Full Site