Announcement Announcement Module
No announcement yet.
Multiple Stored procedures in one DAO using Spring JDBC? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple Stored procedures in one DAO using Spring JDBC?

    I'm a newbie. Here is the sample stored procedure in Spring JDBC. My question is how to add another stored procedure to JdbcActorDao? For example, I have another method: readActorByAge(int Age)? Seems below JdbcActorDao is bound to Procedure read_actor?

    public class JdbcActorDao implements ActorDao {
    private SimpleJdbcTemplate simpleJdbcTemplate;
    private SimpleJdbcCall procReadActor;

    public void setDataSource(DataSource dataSource) {
    this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
    this.procReadActor =
    new SimpleJdbcCall(dataSource)

    public Actor readActor(Long id) {
    SqlParameterSource in = new MapSqlParameterSource()
    .addValue("in_id", id);
    Map out = procReadActor.execute(in);
    Actor actor = new Actor();
    actor.setFirstName((String) out.get("out_first_name"));
    actor.setLastName((String) out.get("out_last_name"));
    actor.setBirthDate((Date) out.get("out_birth_date"));
    return actor;

    Thanks for any explanation.