У меня есть две разные версии реализации J2SE, которая обрабатывает список из 200 элементов
Реализация 1:
//1 Setup EntityManager and begin a transaction
//2 Runs thru the list of 200 items and do entityManager.persist() for each
//3 Commit the transaction
Реализация 2:
//1 Setup EntityManager and begin a transaction
//2 Create a workStealingExecutorService
//3 Adds callable tasks which partitions the list of 200 items into 20 lists
//4 execute the same method being run in #2 of the Implementation 1
//5 invoke the executorService.invokeAll
// Commit the transaction
My Реализация # 1 всегда выполняется успешно и вставляет 200 записей в БД. Реализация # 2 успешно выполняет persist (), но всегда выдает ошибку на этапе транзакции фиксации.
Пожалуйста, помогите мне немного яснее разобраться в этой проблеме.