Announcement Announcement Module
Collapse
No announcement yet.
How to execute simplejdbccall multiple times? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to execute simplejdbccall multiple times?

    This is my code:

    simpleJdbcCall = new SimpleJdbcCall(dataSource);
    simpleJdbcCall.withProcedureName("sp_login")
    .addDeclaredRowMapper(parameterName, rowMapper)
    .returningResultSet(parameterName, rowMapper);

    simpleJdbcCall.addDeclaredParameter(new SqlParameter("userid", Types.VARCHAR));
    simpleJdbcCall.addDeclaredParameter(new SqlParameter("username", Types.VARCHAR));
    simpleJdbcCall.addDeclaredParameter(new SqlOutParameter("result", Types.INTEGER));

    Map<String, Object> result = null;
    for (int i = 1; i <= 100; i++) {

    SqlParameterSource in = new MapSqlParameterSource()
    .addValue("userid", ""+i)
    .addValue("username", "user"+i);

    result=simpleJdbcCall.execute(in);

    }

    Executing 100 times in this way - is the correct one??
    Any alternative solutions???
Working...
X