Hi,
I try to write back (update) a geocode to the database. The values will not saved (selectedGEO_City.setLat() & setLng). I get no exception as well?!
Can anyone help?
// Create the container
GEO_City = JPAContainerFactory.make(Tbl_GEO_City.class, MainWindow.persistenceUnitName);
// bind box to container
udComboBox.setContainerDataSource(GEO_City);
udComboBox.setItemCaptionMode(ItemCaptionMode.PROPERTY);
udComboBox.setItemCaptionPropertyId("name" + MasterWindow.LanguageToken.toUpperCase());
udComboBox.setImmediate(true);
// change of city in combobox
udComboBox.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
if (udComboBox.getValue() != null) {
Tbl_GEO_City selectedGEO_City = GEO_City.getEntityProvider().getEntity(GEO_City, udComboBox.getValue());
// check if geocoding already exist
if(selectedGEO_City.getLat() == 0)
{
// geocoding
GeoCoder udGeoCoder = new GeoCoder();
// parse Address
float coord = udGeoCoder.parseAddress(selectedGEO_City.getNameDE());
// set coords in container
selectedGEO_City.setLat(coord[0]
);
selectedGEO_City.setLng(coord[1]
);
GEO_City.commit();
}
// move to coords
map.setCenter(new LatLon(selectedGEO_City.getLat(), selectedGEO_City.getLng()));
}
}
});