Using one transaction across multiple threads

49 views Asked by At

I want to write parallel into a database via my J2EE application using Hibernate. I am using the ThreadPoolExecutor to generate and execute the threads.

The problem what I am facing is, that when one of the threads are failed, that the whole main transaction is rolled back. How can I achieve that the commit is made by the main thread and not by each of them?

Can I handle this by using ManagedExecutorService and passing the same UserTransaction through all threads?

0

There are 0 answers