Olá pessoal,
seguinte estou tendo problemas com o seguinte código no eclipse
public <T extends BaseTO> Collection<T> listar() throws DAOException {
String sql = getSql("sql.listar.nacionalidade");
NacionalidadeTO nacionalidadeTO;
Collection<T> lista = new ArrayList<T>();
try {
ResultSet result = listar(SqlType.SELECT, sql);
while (result.next()) {
nacionalidadeTO = new NacionalidadeTO();
nacionalidadeTO.setNacionalidade(result.getString("DsNacionalidade"));
nacionalidadeTO.setId(result.getInt("NrRefNacionalidade"));
nacionalidadeTO.setPais(result.getString("DsPais"));
lista.add(nacionalidadeTO);
}
} catch (SQLTypeException e) {
log.error(e.getMessage(), e);
throw new DAOException(e);
} catch (SQLException e) {
log.error(e.getMessage(), e);
throw new DAOException(e);
}
return lista;
o eclipse me dá o seguinte erro na linha lista.add(nacionalidadeTO);
The method add(T) in the type Collection<T> is not applicable for the arguments (NacionalidadeTO)
a idéia deste método é retornar a minha lista de nacionalidades para a tela, porém eu terei que retonar várias listas para a tela, e já que todas as minhas classes TOs são filhas de BaseTO eu resolvi retornar uma colection de classes que são filhas de BaseTO, porque o eclipse me retorna este erro?
alguém pode me ajudar?
valeu galera
[]'s