I haven’t run the code, but something like this should work:
Location existingLocation = locationService.getLocationByUuid(location.getUuid());
if (existingLocation== null) {
locationService.saveLocation(location);
} else {
location.setId(existingLocation.getId());
//evict existing location from Hibernate session as we will attempt to overwrite it
Context.evictFromSession(existingLocation);
locationService.saveLocation(location);
}