Hi everybody.
Anybody here know how can I pass the parameters to ItemRead?
For example, I have a class that process the parameters and return a object that I use on the read() method to search on the database.
The ItemRead class.
Method that use JdbcTemplate to search on the database.
Method that receives the parameters and calls the JdbcTemplate:Code:public List<CategoriaTarifaria> obterDadosCategoriaTarifa(final Integer tarifa){ return jdbcTemplate.query("select tabnum,ctgtrfcod,ctgtrfdes from agekcateg where tabnum = ? and ramcod = 531", new Object[]{tarifa}, new RowMapper() { public Object mapRow(final ResultSet resultSet, final int rowNum) throws SQLException { final CategoriaTarifaria categoriaTarifaria = new CategoriaTarifaria(); categoriaTarifaria.setCodigoCategoriaTarifaria(resultSet.getInt("ctgtrfcod")); categoriaTarifaria.setDescricaoCategoriaTarifaria(resultSet.getString("ctgtrfdes")); return categoriaTarifaria; } }); }
Code:public CategoriaTarifaria read() throws Exception, UnexpectedInputException, ParseException { CategoriaTarifaria categoriaTarifaria = null; VigenciaTarifaria vigenciaTarifaria = gerenciaTarifaria.gerenciarVigenciaTarifaria(nomeTabelaTarifaria, nomeTabela, dataVigencia); if(categoriaTarifas == null){ categoriaTarifas = obterDadosCategoriaTarifa(vigenciaTarifaria.getNumeroTarifa()); } if(!categoriaTarifas.isEmpty()){ categoriaTarifaria = categoriaTarifas.remove(0); } return categoriaTarifaria; }


Reply With Quote