I have a problem fixing an object in a combobox. I explain the situation. I have a mysql a table with a data series (client table), one of those data is a foreign key to another table (city table). In my java program I create an object with the customer's data, fill a comboBox with the list of clients, when you choose one of these clients of the combo, the data is recovered. The city also recovers, once recovered I want that city to be selected in the combo with the list of all the city there is.
That is, if client 1 has city 2, when client 1 is recovered in the city combo, city 2 must appear. But here is the problem that remains empty. I put the code:
CiudadVO ciudad = new CiudadVO();
CiudadDAO ciudaddao = new CiudadDAO();
ciudad = ciudaddao.buscarCiudad(clienteModificado.getIdCiudad());
comboCiudad.setSelectedItem(ciudad);
I create a city object with the id city recovered from the database, this does it well and I tried to print it and that's right, I create a city object from that id, now I want to put it in the combo with setSelectedItem and it does not work. I do not know what the problem is, if anyone knows it would be very helpful.
Thanks