Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spring convert from deprecated

Using SimpleJdbcCall.returningResultSet(ParameterizedBeanPropertyRowMapper) is deprecated with Spring 3.0.5. How would change my code to use a non-deprecated version of this method?

private JdbcTemplate jdbcTemplate;

private SimpleJdbcCall procGetReportExtras;

public void setDataSource(DataSource dataSource) {
    this.jdbcTemplate = new JdbcTemplate(dataSource);

    jdbcTemplate.setResultsMapCaseInsensitive(true);

    this.procGetReportExtras =
            new SimpleJdbcCall(jdbcTemplate)
                .withCatalogName("package")
                .withProcedureName("proc")
                 .returningResultSet("CURREPORTLIST",
                            ParameterizedBeanPropertyRowMapper.newInstance(Report.class));
}
like image 371
Michael Sobczak Avatar asked Feb 15 '23 09:02

Michael Sobczak


1 Answers

You should be able to use a BeanPropertyRowMapper instead of ParameterizedBeanPropertyRowMapper

new SimpleJdbcCall(jdbcTemplate)
            .withCatalogName("package")
            .withProcedureName("proc")
             .returningResultSet("CURREPORTLIST",
                        BeanPropertyRowMapper.newInstance(Report.class));

The call

 BeanPropertyRowMapper.newInstance(Report.class));

returns a BeanPropertyRowMapper instance which implements RowMapper. The non deprecated version of returningResultSet will be used.

like image 56
Sotirios Delimanolis Avatar answered Feb 24 '23 09:02

Sotirios Delimanolis