}
HashSet<AddressObject> children = childrenMap.get(it);
if (children != null && children.size() != 0) {
//создаем несколько записей
for (AddressObject chield : children) {
AddressDistrict addressDistrict = new AddressDistrict();
addressDistrict.setTitle(chield.getTitle());
addressDistrict.setAddressObject(it);
int pos = Math.abs(chield.getTitle().hashCode()) % districtList.size();
addressDistrict.setDistrict(districtList.get(pos));
manager.persist(addressDistrict);
}
} else {
//создаем новую запись
AddressDistrict addressDistrict = new AddressDistrict();
addressDistrict.setTitle("");
addressDistrict.setAddressObject(it);
int pos = Math.abs(it.getTitle().hashCode()) % districtList.size();
addressDistrict.setDistrict(districtList.get(pos));
manager.persist(addressDistrict);
}
}
}
}