piszę sobie aplikacje w hibernate i mam problem z wydajnością przy insertowaniu do bazy danych.
for(int a = 0 ; a<persons.size(); a++) {
Person person = new Person();
Gender gender = new Gender();
gender.setName(persons.get(a).getGender());
gender = genderRepository.save(gender);
Country country = new Country();
country.setName(persons.get(a).getCountry());
country = countryRepository.save(country);
person.setName(personss.get(a).getFirstName());
person.setLastName(persons.get(a).getLastName());
person.setAdditionalInfo(persons.get(a).getIdentifier());
person.setGender(gender);
Set<Country> countries = new HashSet();
countries.add(country);
person.setCountries(countries);
personRepository.save(person);
jak poprawić wydajność insertów?