try (Stream<Car> cars = Car.streamAll()) {
cars.forEach(car->{
saveCar(car);
});
}
problem is im streaming data with over 100k results and im getting
java.lang.OutOfMemoryError: Java heap space
because of it
try (Stream<Car> cars = Car.streamAll()) {
cars.forEach(car->{
saveCar(car);
entityManager.detach(car);
});
}
this is what i have tried, but no result at all.. after like 90k results are processed it starts to slow down like for 1 processed entity per minute and then it throws outofmemoryerror