JAVA BATCH UPDATE/INSERT DATABASE v2

JAVA BATCH UPDATE/INSERT DATABASE v2

Some time ago, I wrote an article about update/insert data to MySQL database JAVA BATCH UPDATE/INSERT DATABASE
since that time, I realized how this method doesn’t suit my needs.
So, I got an advice from my old friend and colleague Dmitri Zutskov and used INSERT … ON DUPLICATE KEY UPDATE method.

To make this method suit my needs, I had to add another column hash, which has UNIQUE flag.
As a result my code looks the following now:

This method improved import of 50000 items, so it take now up to 30 seconds.