I have a ~ 6 GB text file that I need to parse and then save. "Parse" I read a line from a file (usually 2000 characters), create a Car object from a line, and then save it.
I use the consumer-manufacturer sample for parsing and saving, and I wonder if it doesnβt matter (for performance reasons) to save one object at a time or 1000 (or any other amount) in one commit?
At the moment, it takes me> 2 hours to save everything (3 million rows), and it takes too much time for me (or I may be wrong).
I am currently doing this:
public void persistCar(Car car) throws Exception { try { carDAO.beginTransaction();
Before making any design changes, I was wondering if there is a reason why this design is better (or not), and if so, what should car.size () be like? Also, is an open / closed session considered expensive?
public void persistCars(List<Car> cars) throws Exception { try { carDAO.beginTransaction();
source share